Randomize functions
Quote from ljunggren on September 19, 2020, 7:21 pmWe have created a new set of randomizer functions for random number generation, and to simulate random clicks and selections.
Random numbers
In order to generate a random number between 0-100, simply write
/{random:1-100}/
In similar fashion, to generate a number between 1000 and 1005, write
/{random:1000-1005}/You can also exclude numbers. To generate a number between 1-10 but not 5 or 6, write
/{random:1-10|5,6}/Random clicks
You can also use the randomizer to generate a random click. This can be used to generate a random selection between a number of options. Simply select a single element of the selectable elements, and make sure the common parent element is included in the path. Consider you want to select the filter in the following table
http://thelab.boozang.com/tables
BZ.TW.document UL.nav LI:Contains(/{random}/)To exclude the "All species" link, simply add ":|All species".
LI:Contains(/{random:|All species}/)If you instead want to click a random page, use the following selection
BZ.TW.document UL:near(all species lion zebra elephant) A:endContains(/{random}/)Random selections in drop-downs
In order to randomly select something in a drop-down, you can also use this function.
Look at the example
http://theinternet.boozang.com/dropdown
If we want to select between the options in the drop-down start by recording a selection of any element in the drop-down. Instead of modifying the element selector, simple change the "Value" to /{random}/.
Element selector (unchanged)
BZ.TW.document SELECT:near(Dropdown List)Value
/{random}/When running this code, you can see that one-third of the time "Please select an option" is selected, which is problematic. Exclude this in a similar fashion
/{random:|Please select an option}/We hope that this experimental feature can prove useful. By combining this feature with the powerful regex data generator we allow for automated tests that explore more paths in your applications, allowing you to find bugs related to edge cases.
We have created a new set of randomizer functions for random number generation, and to simulate random clicks and selections.
Random numbers
In order to generate a random number between 0-100, simply write
/{random:1-100}/
In similar fashion, to generate a number between 1000 and 1005, write
/{random:1000-1005}/
You can also exclude numbers. To generate a number between 1-10 but not 5 or 6, write
/{random:1-10|5,6}/
Random clicks
You can also use the randomizer to generate a random click. This can be used to generate a random selection between a number of options. Simply select a single element of the selectable elements, and make sure the common parent element is included in the path. Consider you want to select the filter in the following table
http://thelab.boozang.com/tables
BZ.TW.document UL.nav LI:Contains(/{random}/)
To exclude the "All species" link, simply add ":|All species".
LI:Contains(/{random:|All species}/)
If you instead want to click a random page, use the following selection
BZ.TW.document UL:near(all species lion zebra elephant) A:endContains(/{random}/)
Random selections in drop-downs
In order to randomly select something in a drop-down, you can also use this function.
Look at the example
http://theinternet.boozang.com/dropdown
If we want to select between the options in the drop-down start by recording a selection of any element in the drop-down. Instead of modifying the element selector, simple change the "Value" to /{random}/.
Element selector (unchanged)
BZ.TW.document SELECT:near(Dropdown List)
Value
/{random}/
When running this code, you can see that one-third of the time "Please select an option" is selected, which is problematic. Exclude this in a similar fashion
/{random:|Please select an option}/
We hope that this experimental feature can prove useful. By combining this feature with the powerful regex data generator we allow for automated tests that explore more paths in your applications, allowing you to find bugs related to edge cases.