0

I am running my selenium project module which isn't part of the main project, I run the selenium tests with Jacoco maven plugin and the surefire plugin, The Jacoco gives a code coverage (exec file) only of the selenium project and not for the whole project... How do i need to configure my Jacoco and Surefire in order to get an external/whole project coverage??

frieman
  • 31
  • 2
  • 4

3 Answers3

0

It is not true that you can not measure code coverage of your selenium tests. Take a look a t JaCoCo as a tool: https://www.eclemma.org/jacoco/ It can measure the code coverage of: unit, integration, GUI tests and to combine it in one aggregated report.

0

You need to configure a jacoco java agent (tcpserver) in the running project to be tested & a jacococlient (jacococli.jar) to listen to the results.

Example:

java -javaagent:path/to/your/jacocoagent.jar=address=*,port=36320,destfile=jacoco-it.exec,output=tcpserver -jar target/yourApplication.jar

Run end-to-end integration tests.

Dump the results:

java -jar path/to/your/jacococli.jar dump --address localhost --port 36320 --destfile target/jacoco-it.exec
sleep 5
java -jar path/to/your/jacococli.jar report target/jacoco-it.exec --classfiles target/classes --sourcefiles src/main/java/ --html target/jacoco-report
surfealokesea
  • 4,971
  • 4
  • 28
  • 38
-1

I'm not sure if I do not understand your question correctly… But if I understand it correctly, you want to see the code coverage for Selenium Tests on the productive code?

That is simply impossible! Selenium helps you test the web application. Your code is not being tested with Selenium, but just the web pages resulting from the process of your application.

LaurentG
  • 11,128
  • 9
  • 51
  • 66
  • With selenium i test my web app and its functionality, my question is how to see the code coverage of the Web APP... And if this way is not possible, what is the common way to to check the source code coverage of the web app? – frieman Jul 08 '13 at 18:17