Wouldn't it be nice if we had a simple way of running a Selenium HTML Selenese test-suite from a table where each line would be a unique execution of the tests and each column would be a variable value to be used in that test execution ? Wouldn't it be nice if this tool was part of the Selenium package ?
It sure would be nice ! Let's call this tool a Selenses RC Motor. Here's how it could work :
The end-user will supply a CSV or XML file. The first line of the file will be the names of the variables to be imported into Selenium. Each following line will constitute the variables to be passed into a Selenium test run. The motor will loop over each line a run the tests sequentially with one or many browsers. A result file will show success or failure of each line. The results of each pass will be saved in a separate file.
A script will be executed on the command-line. Java seems the most appropriate language because Selenium RC is written in Java, but any language will do.
Initial variables are :
- the path to the CSV (or XML) file
- the variables in the first line of this CSV (or XML) file
- the path to the parameters.html file (the paramters.html file is the first file that the test suite is to read in order to initialize the known variables for each test run)
- the path to the TestSuite.html file that will be run at each test.
- the path where the test results are to be stored
For each line in the master parameter file, the script will write a « params.html » file and then launch the TestSuite.html with Selenium RC.
The resulting file will be saved in the path where the results are to be stored with 000i.html appended to the path where 000i is the ith iteration on four figures. The standard output shows the current iteration being tested and « OK » or « KO » when the test is completed. The paramter files may be saved as params000i.html in some directory. The master parameter file must be copied in the to the results path where « master_params » is appended to the path.