Hi we have a bunch of legacy selenium IDE tests for our product old feature. Is it possible to get code coverage of these selenium IDE scripts? They are NOT JUnits. I want to use clover test optimization for our build system to add the JUnits and selenium IDE scripts to minimize the test execution time and run the tests that actually matters for the code change. Usually we run selenium IDE tests from command prompt as below :-
java -jar D:\SeleniumTest\selenium-server-standalone-2.33.0.jar -htmlSuite "*firefox" "http://www.google.com" "D:\SeleniumTest\SeleniumSuite.HTML" "D:\SeleniumTest\seleniumtestresult.html"
Thanks for your help
Shankar KC
Hi Shankar,
Yes, it's possible with Clover, however it would require effort on your side in order to change how your selenium tests are launched.
In this test configuration, several processes are running:
JVM process with selenium driver ---> Firefox process ---> JVM process with your application backend
I assume that you want to measure per-test coverage for selenium tests and optimize them according to classes called at your application's backend.
First thing is to enable a distributed coverage feature in Clover:
https://confluence.atlassian.com/display/CLOVER/Working+with+Distributed+Applications
Second thing is to tell Clover when your Selenium test starts and ends. This is tricky, because there's no way to do this at runtime (there's a feature request for it - CLOV-127 - but it's not planned in a near future). Clover can identify test boundaries at compile time only - it recognizes JUnit and TestNG frameworks by default.
It means that you have to wrap call of every single Selenium test inside a single JUnit/TestNG test method and instrument such test wrapper with Clover. Such wrapper could look like this:
public class MySeleniumTests { @Before public void setUp() { // call System.exec() with Selenium runner, runner should pause } @Test public void seleniumTest1() { // send signal to run test #1 } @Test public void seleniumTest2() { // send signal to run test #2 } ... }
Next you have to run MySeleniumTests with -Dclover.server=true JVM property.
The trick works this way:
The problem is how to:
It's up to you how to implement this. For instance, your selenium tests could wait until some marker file becomes available on a disk; and such file would be created in MySeleniumTests class. Or your could read data from a pipe. Etc.
See more details here:
https://confluence.atlassian.com/display/CLOVER/Measuring+per-test+coverage+for+manual+tests
Cheers
Marek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.