0

I am trying to get the IT coverage report in my project using jacoco & Jetty. I'm running my integration tests against jetty (using the maven plugin). I have done the setup. Here is my POM

<profile>
        <id>quality-check</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.17</version>
                    <configuration>
                        <argLine>${surefireArgLine}</argLine>
                        <skipTests>false</skipTests>
                        <excludes>
                            <exclude>**/*IT*</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.12</version>
                    <configuration>
                        <skipTests>false</skipTests>
                        <includes>
                            <include>**/*IT*</include>
                        </includes>
                        <systemPropertyVariables>
                            <!--  ... //Whatever you need to configure on your integration test, if any.-->
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.7.5.201505241946</version>
                    <executions>
                        <execution>
                            <id>pre-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                                <excludes>
                                    <exclude>**/*Test*</exclude>
                                </excludes>
                                <propertyName>surefireArgLine</propertyName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-unit-test</id>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>pre-integration-test</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
                                <excludes>
                                    <exclude>**/*Test*</exclude>
                                </excludes>
                                <propertyName>jacoco.agent.itArgLine</propertyName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>post-integration-test</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-maven-plugin</artifactId>
                    <version>9.2.10.v20150310</version>
                    <executions>
                        <execution>
                            <id>start-jetty</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                                <goal>run-forked</goal>
                            </goals>
                            <configuration>
                                <scanIntervalSeconds>0</scanIntervalSeconds>
                                <daemon>true</daemon>
                                <waitForChild>false</waitForChild>
                                <maxStartupLines>200</maxStartupLines>
                                <jvmArgs>${jacoco.agent.itArgLine} -Djetty.port=${integration.tests.jetty.port}</jvmArgs>
                            </configuration>
                        </execution>
                        <execution>
                            <id>stop-jetty</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>stop</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <scanIntervalSeconds>10</scanIntervalSeconds>
                        <stopKey>STOP</stopKey>
                        <stopPort>9999</stopPort>
                        <httpConnector>
                            <port>${integration.tests.jetty.port}</port>
                        </httpConnector>
                        <contextXml>../integrationTest/jetty_context.xml</contextXml>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

jetty_context.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"     "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/SAI</Set>
  <Set name="extraClasspath">../testResources/src/test/resources</Set>
</Configure>

the setup is done base on the post Jacoco and jetty maven plugin gets 0% coverage. But no luck yet.

The coverage is 0%

in the log I can see an error:

[INFO] Forked process starting
[INFO] Forked process startup errors

Can some one help me please? Do I have to do anything else.

Community
  • 1
  • 1

0 Answers0