Published on: Jan 15, 2019
Topics: Technical Agility
In my previous blog I shared about the features of the newly resurrected Selenium IDE. Right from the initial days of Selenium IDE as the tool, there has been a stigma attached to it because it is a recording and playback tool which leads to flaky and brittle test automation scripts. This is mostly attributed to the “hard coded” locators which make the test scripts difficult to maintain. Also since Selenium IDE worked on Selenese commands it lacked the real programming language power and flexibility. However one thing that makes it work is it’s simplicity, easy learning curve and therein lies it’s true power. Now that some of the above mentioned shortcomings are taken care of in its new avatar to some extent, let’s look at some additional features that make this simple tool solve big problems.
Selenium IDE comes with SIDE Runner → https://github.com/SeleniumHQ/selenium-ide/tree/master/packages/selenium-side-runner
Using the SIDE Runner, the Selenium IDE tests can be run from command line and that opens up lot of possibilities to integrate it with CICD pipeline. The installation details are provided on the above mentioned github link however I am listing it here for quick reference and start.
Go to the folder where the Selenium IDE .side test project is saved and run the command as below:
$ selenium-side-runner Wiki.side
The command line output is displayed as below. It shows the status (PASS/FAIL) and the total time taken to run the Test Suite in the Wiki.side project. And also show the individual test cases status and execution time. If there were more than one Test Suites then they would all run and similar report would be displayed on the command line.
In case you wish to run selected Test Suite then --filter option can be used to provide the name of the Test Suite, as below:
$ selenium-side-runner Wiki.side --filter Wiki-Positive
Another strong feature of SIDE Runner is to have the Tests run in parallel, once this option is enabled the the tests will be triggered simultaneously and save on overall execution time.
Please notice the difference in the execution time 7.319s vs. 18.364s (in serial execution mode). Also notice that when running the parallel, SIDE Runner treats each test cases as a Test Suite and that’s why it displayed Test Suites: 3 passed, 3 total.
We can create a Jenkins job with Shell script to call the SIDE Runner with the given parameters. One of the biggest shortcoming and stigma attached to Selenium IDE gets washed off that we can not run IDE script in a CICD pipeline. Yes, we can!
That said, we have lots of ground to cover, Selenium IDE does not integrate with build tools, there is no report generation, also the much used Export to programming language feature is not yet available. The new Selenium IDE is off to a great start, looking forward to much more in the time to come.
Please watch video for more details