We already learnt about data driven testing by attaching external data file with selenium IDE in my previous post. In that case we have used "storeEval" command to fetch data from external .js file. Another way of data driven testing in selenium IDE is using push command. Now let we learn how can we createarray inside selenium IDE for parameterisation. Here concept is same as both previous methods but way is little different.
Here we will use "storeEval" and "getEval" commands for creating parameterisation script. Let we look at bellow given example.
|storeEval||new Array("car","truck", "Bus", "motorcycle", "bicycle");||vehicles|
|while||myitems < storedVars['vehicles'].length|
(Note : You need to attache external user extension file with selenium IDE to get support of "while" command in selenium IDE. Click here to read article about how to attach user extension.js with selenium IDE)
In above example,
"storeEval" command will create one array to store all vehicle's values. "getEval" command will store value 0 in variable 'myitems'. while loop will rotate until end of the array item and echo command will print related values in log every time. Execute above script in your selenium IDE first then you can use same parameterisation method with your software application test script.