java - How can I fire integration tests separately using failsafe-plugin? -


i cannot run integration tests, unit tests.

here maven config (see code below). uses 2 plugins. 1 of them maven-failsafe-plugin , second 1 maven-surefire-plugin.

<properties>     <project.build.sourceencoding>utf-8</project.build.sourceencoding>     <project.reporting.outputencoding>utf-8</project.reporting.outputencoding>     <skiptests>false</skiptests>     <skipits>${skiptests}</skipits>     <skiputs>${skiptests}</skiputs> </properties> <dependencies>     <dependency>         <groupid>org.testng</groupid>         <artifactid>testng</artifactid>         <version>6.8.7</version>     </dependency> </dependencies> <build>     <plugins>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-surefire-plugin</artifactid>             <version>2.16</version>             <configuration>                 <skiptests>${skiputs}</skiptests>             </configuration>         </plugin>         <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-failsafe-plugin</artifactid>             <version>2.16</version>             <configuration>                 <skiptests>${skiptests}</skiptests>                 <skipits>${skipits}</skipits>             </configuration>             <executions>                 <execution>                     <goals>                         <goal>integration-test</goal>                         <goal>verify</goal>                     </goals>                 </execution>             </executions>         </plugin>     </plugins> </build> 

i try run unit tests using commend

mvn clean test 

and there command start integration tests separately

mvn clean failsafe:integration-test verify 

result of invocation of last command

[info] --- maven-failsafe-plugin:2.16:integration-test (default-cli) @ integration-test-demo --- [info] no tests run. 

i use profiles these:

properties

<properties>         <!-- unit tests run default. -->         <skip.integration.tests>true</skip.integration.tests>         <skip.unit.tests>false</skip.unit.tests>     </properties> 

profiles

<profiles>         <profile>             <id>all-tests</id>             <properties>                 <build.profile.id>all-tests</build.profile.id>                 <!-- tests run. -->                 <skip.integration.tests>false</skip.integration.tests>                 <skip.unit.tests>false</skip.unit.tests>             </properties>         </profile>         <profile>             <id>dev</id>         </profile>         <profile>             <id>integration-tests</id>             <properties>                 <!-- used locate profile specific configuration file. -->                 <build.profile.id>integration-test</build.profile.id>                 <!-- integration tests run. -->                 <skip.integration.tests>false</skip.integration.tests>                 <skip.unit.tests>true</skip.unit.tests>             </properties>         </profile>     </profiles> 

maven-surefire-plugin

        <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-surefire-plugin</artifactid>             <version>2.15</version>             <configuration>                 <!-- skips unit tests if value of skip.unit.tests property true -->                 <skiptests>${skip.unit.tests}</skiptests>                 <!-- excludes integration tests when unit tests run. -->                 <excludes>                     <exclude>**/*integrationtest.java</exclude>                 </excludes>             </configuration>         </plugin> 

maven-failsafe-plugin

        <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-failsafe-plugin</artifactid>             <version>2.15</version>             <executions>                 <!-- ensures both integration-test , verify goals of failsafe maven plugin executed. -->                 <execution>                     <id>integration-tests</id>                     <goals>                         <goal>integration-test</goal>                         <goal>verify</goal>                     </goals>                     <configuration>                         <!-- skips integration tests if value of skip.integration.tests property true -->                         <skiptests>${skip.integration.tests}</skiptests>                         <includes>                             <include>**/*integrationtest.java</include>                         </includes>                     </configuration>                 </execution>             </executions>         </plugin> 

the integration tests end in ...integrationtest.java, , run profile required (all-tests, integration-tests). unit tests run default.

i pretty sure copied somewhere, can not remember link. sorry.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -