maven - Include testing test groups for failsafe (integration testing) only but exclude them from surefire -


the following config not work. no test in scope goal integration-test.

in case unclear, should happen mvn integration-test failsafe plugin should run test. surefire plugin configuration excluding test. if uncomment surefire config block test run during integration-test goal.

maven config:

<build>     <plugins>         <plugin>             <artifactid>maven-failsafe-plugin</artifactid>             <executions>                 <execution>                     <id>integration-test</id>                     <goals>                         <goal>integration-test</goal>                         <goal>verify</goal>                     </goals>                 </execution>             </executions>             <configuration>                 <groups>spring-container-sanity</groups>             </configuration>         </plugin>         <plugin>             <artifactid>maven-surefire-plugin</artifactid>             <configuration>                 <excludedgroups>spring-container-sanity</excludedgroups>             </configuration>         </plugin>     </plugins> </build> 

a java test class

@springapplicationconfiguration(testapplication.class) @testpropertysource("/test.properties") public class simpletest extends abstracttestngspringcontexttests {     @test(groups = "spring-container-sanity")     public void ishessianserviceexported() throws exception {       /*...*/      } } 

i don't know why tests run when surefire disabled. failsafe has file naming convention integration tests, if tests want run not follow won't in scope , group rule have nothing match. so, in case failsafe resolve tests should run correctly first need add include filter. build block work:

<build>     <plugins>         <plugin>             <artifactid>maven-failsafe-plugin</artifactid>             <executions>                 <execution>                     <id>integration-test</id>                     <goals>                         <goal>integration-test</goal>                         <goal>verify</goal>                     </goals>                 </execution>             </executions>             <configuration>                 <includes>                     <include>**/*.java</include>                 </includes>                 <groups>spring-container-sanity</groups>             </configuration>         </plugin>         <plugin>             <artifactid>maven-surefire-plugin</artifactid>             <configuration>                 <excludedgroups>spring-container-sanity</excludedgroups>             </configuration>         </plugin>     </plugins> </build> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -