Creating a randomized GUI test

Best practices, code snippets for common functionality, examples, and guidelines.
Diloneus
Posts: 2
Joined: Tue Jul 31, 2018 5:37 pm

Creating a randomized GUI test

Post by Diloneus » Tue Jul 31, 2018 5:40 pm

Hello,

I've been trying to figure out a method to automate a random GUI test on a windows application. I'm using the Spy Tracker to select one path, but I was wondering if there was a way to create a lot of optional paths that the test can run through so that the test is not the same every time it runs but rather running through a lot of different scenarios. So far I haven't found even a starting point to attempt this, as I am a novice at Ranorex but learning.

Thank you!

BSullivan
Posts: 32
Joined: Thu Jun 04, 2015 6:31 pm
Location: HorseHeads NY
Contact:

Re: Creating a randomized GUI test

Post by BSullivan » Wed Aug 01, 2018 3:59 pm

We use Ranorex for something like this.

We go about it by using multiple levels of switches, code methods to randomly select items from lists or combos, and random number generators.

This specific test, we use more for "Just poking at stuff" because it is hard to build any meaningful validation steps into it other than the box you checked is in the correct state after you randomly decided that it needed to be checked. This is helpful for us in finding unintended loops, crashes, or scenarios that we did not think about while writing our automated tests.

Diloneus
Posts: 2
Joined: Tue Jul 31, 2018 5:37 pm

Re: Creating a randomized GUI test

Post by Diloneus » Wed Aug 01, 2018 5:24 pm

BSullivan wrote:
Wed Aug 01, 2018 3:59 pm
We use Ranorex for something like this.

We go about it by using multiple levels of switches, code methods to randomly select items from lists or combos, and random number generators.

This specific test, we use more for "Just poking at stuff" because it is hard to build any meaningful validation steps into it other than the box you checked is in the correct state after you randomly decided that it needed to be checked. This is helpful for us in finding unintended loops, crashes, or scenarios that we did not think about while writing our automated tests.
Would you happen to know where you're coding in the random number generators and picking buttons from in the path?

BSullivan
Posts: 32
Joined: Thu Jun 04, 2015 6:31 pm
Location: HorseHeads NY
Contact:

Re: Creating a randomized GUI test

Post by BSullivan » Wed Aug 01, 2018 6:25 pm

We use enums for the buttons and other controls.

So we generate a random number between 0 and the length of the Enumerator list, and based on that Enumerator, we set the value of a Repository variable. This variable is used by all of the controls that could be selected by this in the same way, i.e. the "AccessableName". Once the variable is set, the action is taken on the element.

For things like listboxes and comboboxes, we do the above to get the combo and click it, then we get a list of the items that it contains via the Ranorex API and pick a random one to interact with.

All of it is custom coded in C# Classes.