我的Java项目中有一个模块,具有多个集成测试。其中两个是UpgradeDatabase.java和CreateDatabase.java,它们在预集成阶段的每次运行中都会执行。 我想安排这些只在一段时间内运行一次(比方说每月),因为它们执行时间太长(很多数据库创建等),我该如何实现这一目标? 我的故障安全插件配置看起来是这样的(注意,该skip.selenium.tests参数为false):Maven集成测试的有条件运行
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<forkMode>${tests.forkMode}</forkMode>
<skip>${skip.selenium.tests}</skip>
<environmentVariables>
...this area skipped...as it's non important
</environmentVariables>
<systemPropertyVariables>
<!--<rc.count.firefox>${rc.count.firefox}</rc.count.firefox>-->
<selenium.browser>firefox</selenium.browser>
<user.home>${env.USERPROFILE}</user.home>
</systemPropertyVariables>
</configuration>
<executions>
<!--before the tests-->
<execution>
<id>upgrade-the-database</id>
<configuration>
<includes>
<include>**/UpgradeDatabase.java</include>
</includes>
</configuration>
<phase>pre-integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
<!--before the tests-->
<execution>
<id>recreate-the-database</id>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<includes>
<include>**/CreateDatabase.java</include>
</includes>
</configuration>
<phase>pre-integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
您使用的是JUnit还是TestNG? – luboskrnac 2014-09-30 14:45:07
我正在使用JUnit – misha 2014-10-02 12:42:18