maven故障安全插件需要能够区分单元测试和集成测试.似乎在使用JUnit时,一种分离测试的方法是使用JUnit @Categories注释.这篇博文显示如何使用junit http://www.agile-engineering.net/2012/04/unit-and-i
@Category(IntegrationTest.class)
public class ExampleIntegrationTest{
@Test
public void longRunningServiceTest() throws Exception {
}
}
如何使用TestNG和Maven故障安全插件完成相同的操作.我想在测试类上使用注释将它们标记为集成测试.
这可以添加到测试中.@IfProfileValue(name="test-profile", value="IntegrationTest")
public class PendingChangesITCase extends AbstractControllerIntegrationTest {
...
}
要选择要执行的测试,只需将值添加到配置文件以执行集成测试.
<properties>
<test-profile>IntegrationTest</test-profile>
</properties>
如果选择的maven配置文件没有属性值,则不会执行集成测试.
