【发布时间】:2014-11-25 05:28:45
【问题描述】:
我的 Java 项目中有一个包含多个集成测试的模块。其中两个是 UpgradeDatabase.java 和 CreateDatabase.java,它们当前在预集成阶段的每次运行时执行。 我想安排这些只运行一次(比如说每月一次),因为它们执行时间太长(创建了许多数据库等),我该如何实现呢? 我的故障保护插件配置如下所示(注意,skip.selenium.tests 参数为 false):
<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?
标签: maven testing conditional integration teamcity-8.0