0
votes

I use surefire and failsafe to execute unit tests respectively, integration tests. All tests reside in the folder src/test/java. So far I have one integration test class TaskAdditionIT.java whose test methods (annotated with @Test) are never executed while all unit tests are run. This is an excerpt of my pom.xml:

<plugin>                                          
    <groupId>org.apache.maven.plugins</groupId>   
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.18.1</version>                     
</plugin>                                         
<plugin>                                          
    <groupId>org.apache.maven.plugins</groupId>   
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.18.1</version>                     
    <configuration>                               
        <executions>                              
            <execution>                           
                <goals>                           
                    <goal>integration-test</goal> 
                    <goal>verify</goal>           
                </goals>                          
            </execution>                          
        </executions>                             
    </configuration>                              
</plugin>   

I use the maven goal verify to run the tests.

1

1 Answers

0
votes

Solution:

Do not nest executions inside configuration:

<plugin>                                          
    <groupId>org.apache.maven.plugins</groupId>   
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.18.1</version>                              
    <executions>                              
        <execution>                           
            <goals>                           
                <goal>integration-test</goal> 
                <goal>verify</goal>           
            </goals>                          
        </execution>                          
    </executions>                              
</plugin>