Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is is possible to get the PerTestCoverage for Functional Tests?

Thisal Abeysooriya March 19, 2018

Please find the below steps which I followed to capture code coverage for Functional Tests(Selenium Automation Scripts) using Clover.

 

Step 1 : I downloaded a sample petclinic application which is a java spring-boot application.

Step 2 : Then managed to instrument the code using maven goal - mvn clover:instrument

Step 3 : Clover DB and a Instrumented jar will be generated as Clover artifacts after instrumentation.

Step 4 : Start the server using the Instrumented Jar pointing towards Clover DB as mentioned bellow.
java –jar -Dclover.initstring.basedir={CloverDatabaseLocation} {InstrumentedBootableJar}

Step 5 : Run TestNG Functional Tests(Selenium Automation Scripts) from a different instance against the application URL. These tests are not included in the application source code.

Step 6 : Generate a report using mvn clover:clover goal.

 

Findings : The code coverage will be recorded and displayed on the report.

But under "Test Results", the following message was populated. So it is not possible to get the PerTestCoverage.

--------------------------------------------------------------------------------------------------
No test results

No test results could be found. Please ensure that you have instrumented your unit tests correctly.

--------------------------------------------------------------------------------------------------

Is there a way we can tell openclover that this particular test started and ended at this time or some similar mechanism to capture Tests and Per Test Coverage for functional tests? 

 

Note: Functional tests are in a different project which will run on a different instance. 

 

@Grzegorz Lewandowski

 

Thanks in Advance.

 

 

 

 

 

2 answers

0 votes
Grzegorz Lewandowski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 21, 2018

Hey,

 

In order to have Clover/OpenClover recognize per-test coverage you must instrument test sources as well.

 

Furthermore in a setup like your, when tests run in different JVM than an app you must use distributed coverage feature, which basically mean instrumenting sources with proper option and then starting both JVMs (an app and test) with specific system properties

Here's documentation how to achieve that: https://confluence.atlassian.com/clover/using-distributed-per-test-coverage-184025273.html

0 votes
Thisal Abeysooriya March 20, 2018

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events