Selenium is unarguably the most popular open source functional testing tool for web based apps. Selenium is to functional testing what JUnit is to Unit Testing. Hence, it would be unfair to delay covering our integration to Selenium in our monthly series on test automation integration. Like always, it’s assumed that you have some basic understanding of ZBOT and are familiar with nUnit based frameworks.
There are multiple approaches to kick off and execute Selenium tests via Zephyr/ZBot.
Tests are completely treated external to ZBOT and are executed using some type of executable or batch file passing individual test class to it. After execution, result are collected in flat files. ZIP can then parse output files and update the result. This approach can further be expanded to pass entire test suite to executable/bat file. External executable will run the entire suite and ZIP will then parse result for all executed test cases. This would require some kind of unique identifier per test to tie executed test case back to Zephyr test case so that result can be determined accurately.
As ZBot is a java based utility, its possible to kick off selenium test cases by directly invoking test/suite class from within ZIP. There are few things that must be noted.
- ZBot will need to load all selenium test classes, selenium driver and other require libraries. All these libraries must be in class path of the Zbot.
- Running tests within the ZBot process, will lock ZBot making it unusable for the period of test execution. In most scenarios this should be desired (most UI tests should run sequential and ZBot shouldn’t be available.
- Running tests within the ZBot process, will lock make ZBot vulnerable to same issues that may arise in typical test execution (out of memory errors etc). To get around these, ZBot may need to be tuned appropriately.
Biggest advantage of this approach is that all the execution data is available to ZIP in memory which would eliminate the need of any additional parsing to determine test results.
Current demo is written using external approach. There is a bat file available on the test machine. User kick off the tests from Zephyr UI with full path of the bat file, followed by test class and output path. ZIP starts a new process with this detail. Selenium test runs and when its completed, ZIP reads the output from given output folder and updates Zephyr.
Native approach is a very interesting way of launching any java based testing framework and we will explore that in next post.
Thanks for reading this post and please feel free to contact us with your issues / comments or chime in on our documentation page (Git) Please watch this video overview of running Selenium scripts with Zephyr's ZBots.
Zephyr's mission is to build real-time test management products that support the software quality initiatives of our global customers, thereby allowing them to be more responsive and make better decisions, faster.