As stated in documentation about "prepare-agent" mojo at page 
http://www.jacoco.org/jacoco/trunk/doc/prepare-agent-mojo.html :

Prepares a property pointing to the JaCoCo runtime agent that can be passed 
> as a VM argument to the application under test.


By default it will set "argLine" property, but spring-boot-maven-plugin 
doesn't take into account this property by default and you're not passing 
it explicitly , hence spring-boot-maven-plugin starts JVM without JaCoCo 
agent.


On Wednesday, June 14, 2017 at 6:22:59 PM UTC+2, Martin Dietze wrote:
>
>
> I am working on a spring-boot webservice using maven and the 
> spring-boot-maven-plugin. As usual, unit and integration tests are executed 
> separately.
>
> For integration tests I use the spring-boot-maven-plugin where I run 
> 'start' in the phase 'pre-integration-test' to start the spring boot 
> application and then 'stop' in the pase 'post-integration-test' to shut it 
> down again.
>
>
> There is no issue with the unit tests, however when running integration 
> tests, the coverage from tests sending requests to the running webservice 
> application is not recorded. I don't see any error message. 
>
>
> My pom.xml contains these relevant sections:
>
>
>       <plugin>
>         <groupId>org.jacoco</groupId>
>         <artifactId>jacoco-maven-plugin</artifactId>
>         <version>${jacoco.version}</version>
>         <configuration>
>           <excludes>
>             <exclude>com/mycompany/generated/**/*</exclude>
>           </excludes>
>         </configuration>
>         <executions>
>           <execution>
>             <id>jacoco-initialize-ut</id>
>             <phase>initialize</phase>
>             <goals>
>               <goal>prepare-agent</goal>
>             </goals>
>           </execution>
>           <execution>
>             <id>jacoco-initialize-it</id>
>             <phase>pre-integration-test</phase>
>             <goals>
>               <goal>prepare-agent-integration</goal>
>             </goals>
>           </execution>
>           <execution>
>             <id>jacoco-report</id>
>             <phase>verify</phase>
>             <goals>
>               <goal>report</goal>
>               <goal>report-integration</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
>
>       <plugin>
>         <groupId>org.springframework.boot</groupId>
>         <artifactId>spring-boot-maven-plugin</artifactId>
>         <version>${springboot.version}</version>
>         <executions>
>           <execution>
>             <id>pre-integration-test</id>
>             <goals>
>               <goal>start</goal>
>             </goals>
>             <configuration>
>               <arguments>
>                 <argument>--integration-test</argument>
>               </arguments>
>               <maxAttempts>3</maxAttempts>
>               <wait>10000</wait>
>               <fork>true</fork>
>             </configuration>
>           </execution>
>           <execution>
>             <id>post-integration-test</id>
>             <goals>
>               <goal>stop</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-failsafe-plugin</artifactId>
>         <configuration>
>           <groups>${integrationTestGroups}</groups>
>           <includes>
>             <include>**/*.java</include>
>           </includes>
>         </configuration>
>         <executions>
>           <execution>
>             <goals>
>               <goal>integration-test</goal>
>               <goal>verify</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>
>
> As seen here I am sticking pretty much to the defaults. 
>
> Any idea what I am doing wrong? 
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/6c92505c-60c2-45a9-88db-307092cd1b03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to