title: Integrating JaCoCo, Arquillian and REST Assured brings me a code coverage of 0%
body: <p>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.</p>
  
  <p>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).</p>
  
  <p>As JaCoCo is on the same JVM, I thought the coverage wouldn't suffer any changes, but it brings me 0%.</p>
  
  <p>Can anyone help me with this?</p>
  
  <p>Follows my maven profile on pom.xml:</p>
  
  <pre><code>&lt;profile&gt;
          &lt;id&gt;test-postgresql&lt;/id&gt;
  
          &lt;properties&gt;
              &lt;datasource.driver&gt;postgresql.jar&lt;/datasource.driver&gt;
              &lt;datasource.driverClass&gt;org.postgresql.Driver&lt;/datasource.driverClass&gt;
              &lt;datasource.url&gt;jdbc:postgresql://localhost:5432/security-test&lt;/datasource.url&gt;
              &lt;datasource.user&gt;postgres&lt;/datasource.user&gt;
              &lt;datasource.password&gt;a&lt;/datasource.password&gt;
          &lt;/properties&gt;
  
          &lt;dependencies&gt;
              &lt;!-- WildFly Container Managed --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.wildfly&lt;/groupId&gt;
                  &lt;artifactId&gt;wildfly-arquillian-container-managed&lt;/artifactId&gt;
                  &lt;version&gt;${wildfly.version}&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
  
              &lt;!-- PostgreSQL JDBC Driver --&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;postgresql&lt;/groupId&gt;
                  &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
                  &lt;version&gt;${jdbc.postgresql.version}&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
  
          &lt;build&gt;
              &lt;plugins&gt;
                  &lt;!-- Dependency Plugin --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                      &lt;version&gt;${plugin.dependency.version}&lt;/version&gt;
                      &lt;executions&gt;
                          &lt;!-- Unpack WildFly --&gt;
                          &lt;execution&gt;
                              &lt;id&gt;unpack-wildfly&lt;/id&gt;
                              &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;unpack&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;artifactItems&gt;
                                      &lt;artifactItem&gt;
                                          &lt;groupId&gt;org.wildfly&lt;/groupId&gt;
                                          &lt;artifactId&gt;wildfly-dist&lt;/artifactId&gt;
                                          &lt;version&gt;${wildfly.version}&lt;/version&gt;
                                          &lt;type&gt;zip&lt;/type&gt;
                                          &lt;overWrite&gt;false&lt;/overWrite&gt;
                                          &lt;outputDirectory&gt;target&lt;/outputDirectory&gt;
                                      &lt;/artifactItem&gt;
                                  &lt;/artifactItems&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
  
                          &lt;!-- Deploy JDBC Driver --&gt;
                          &lt;execution&gt;
                              &lt;id&gt;copy-driver&lt;/id&gt;
                              &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;copy&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;artifactItems&gt;
                                      &lt;artifactItem&gt;
                                          &lt;groupId&gt;postgresql&lt;/groupId&gt;
                                          &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
                                          &lt;version&gt;${jdbc.postgresql.version}&lt;/version&gt;
                                          &lt;type&gt;jar&lt;/type&gt;
                                          &lt;overWrite&gt;false&lt;/overWrite&gt;
                                          &lt;outputDirectory&gt;target/wildfly-${wildfly.version}/standalone/deployments&lt;/outputDirectory&gt;
                                          &lt;destFileName&gt;${datasource.driver}&lt;/destFileName&gt;
                                      &lt;/artifactItem&gt;
                                  &lt;/artifactItems&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
  
                  &lt;!-- Skip Unit Tests --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                      &lt;version&gt;${plugin.surefire.version}&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;skipTests&gt;true&lt;/skipTests&gt;
                      &lt;/configuration&gt;
                  &lt;/plugin&gt;
  
                  &lt;!-- Integration Tests --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                      &lt;artifactId&gt;maven-failsafe-plugin&lt;/artifactId&gt;
                      &lt;version&gt;${plugin.failsafe.version}&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;argLine&gt;${jacoco.agent.it.arg}&lt;/argLine&gt;
                          &lt;redirectTestOutputToFile&gt;false&lt;/redirectTestOutputToFile&gt;
                          &lt;systemPropertyVariables&gt;
                              &lt;java.util.logging.manager&gt;org.jboss.logmanager.LogManager&lt;/java.util.logging.manager&gt;
                              &lt;jboss.home&gt;${project.basedir}/target/wildfly-${wildfly.version}&lt;/jboss.home&gt;
                              &lt;module.path&gt;${project.basedir}/target/wildfly-${wildfly.version}/modules&lt;/module.path&gt;
                          &lt;/systemPropertyVariables&gt;
                          &lt;skipTests&gt;false&lt;/skipTests&gt;
                          &lt;includes&gt;
                              &lt;include&gt;**/test/**/*.java&lt;/include&gt;
                          &lt;/includes&gt;
                      &lt;/configuration&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;integration-test&lt;/id&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;integration-test&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                          &lt;execution&gt;
                              &lt;id&gt;verify integration-test&lt;/id&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;verify&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
  
                  &lt;!-- Liquibase Plugin (Drop Database) --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.liquibase&lt;/groupId&gt;
                      &lt;artifactId&gt;liquibase-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;${liquibase.version}&lt;/version&gt;
                      &lt;configuration&gt;
                          &lt;driver&gt;${datasource.driverClass}&lt;/driver&gt;
                          &lt;url&gt;${datasource.url}&lt;/url&gt;
                          &lt;username&gt;${datasource.user}&lt;/username&gt;
                          &lt;password&gt;${datasource.password}&lt;/password&gt;
                          &lt;promptOnNonLocalDatabase&gt;false&lt;/promptOnNonLocalDatabase&gt;
                      &lt;/configuration&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;drop-database&lt;/id&gt;
                              &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;dropAll&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
  
                  &lt;!-- JaCoCo Plugin --&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
                      &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;${plugin.jacoco.version}&lt;/version&gt;
                      &lt;dependencies&gt;
                          &lt;!-- JaCoCo --&gt;
                          &lt;dependency&gt;
                              &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
                              &lt;artifactId&gt;org.jacoco.core&lt;/artifactId&gt;
                              &lt;version&gt;${plugin.jacoco.version}&lt;/version&gt;
                          &lt;/dependency&gt;
  
                          &lt;!-- Arquillian JaCoCo --&gt;
                          &lt;dependency&gt;
                              &lt;groupId&gt;org.jboss.arquillian.extension&lt;/groupId&gt;
                              &lt;artifactId&gt;arquillian-jacoco&lt;/artifactId&gt;
                              &lt;version&gt;1.0.0.Alpha8&lt;/version&gt;
                          &lt;/dependency&gt;
                      &lt;/dependencies&gt;
                      &lt;configuration&gt;
                          &lt;append&gt;true&lt;/append&gt;
                      &lt;/configuration&gt;
                      &lt;executions&gt;
                          &lt;execution&gt;
                              &lt;id&gt;jacoco-agent&lt;/id&gt;
                              &lt;phase&gt;pre-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;prepare-agent-integration&lt;/goal&gt;
                              &lt;/goals&gt;
                              &lt;configuration&gt;
                                  &lt;destFile&gt;${sonar.jacoco.itReportPath}&lt;/destFile&gt;
                                  &lt;propertyName&gt;jacoco.agent.it.arg&lt;/propertyName&gt;
                                  &lt;append&gt;true&lt;/append&gt;
                              &lt;/configuration&gt;
                          &lt;/execution&gt;
  
                          &lt;execution&gt;
                              &lt;id&gt;jacoco-report&lt;/id&gt;
                              &lt;phase&gt;post-integration-test&lt;/phase&gt;
                              &lt;goals&gt;
                                  &lt;goal&gt;report-integration&lt;/goal&gt;
                              &lt;/goals&gt;
                          &lt;/execution&gt;
                      &lt;/executions&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  </code></pre>