Skip to content
Advertisement

Integrating JaCoCo, Arquillian and REST Assured brings me a code coverage of 0%

I’m using JaCoCo, Arquillian and rest-assured to test my RESTFul API. The problem is that I’m getting a 0% code coverage within my JaCoCo report. I’m using a maven profile for test cases, getting a wildfly instance, deploying it on JVM, deploying my API and then running the tests.

I’ve made some researches and reach the point where I know that JaCoCo must be running on same JVM where the .war file is running (What is my case).

As JaCoCo is on the same JVM, I thought the coverage wouldn’t suffer any changes, but it brings me 0%.

Can anyone help me with this?

Follows my maven profile on pom.xml:

JavaScript

Advertisement

Answer

I’ve had to configure the JaCoCo agent when Arquillian started the container. Actually, my jacoco plugin becomes:

pom.xml

JavaScript

In the arquillian.xml arguments, add the ${jacoco.agent} variable at the end of “javaVmArguments” property. Like this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement