java Maven使用category和profile运行特定的测试,但不使用groups标记
我正在与maven和Junit一起参与我的项目。 我想使用配置文件来运行特定的测试:
我发现这个guide:
我有两个个人资料:
<profiles>
<profile>
<id>fastTests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<groups>example.com.FastHolder</groups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>devProfile</id>
<activation>
<activeByDefault>false</activeByDefault></activation>
<build>
ant @Test
类如下所示:
@RunWith(MockitoJUnitRunner.class)
@Category(FastHolderHolder.class)
public class FastHolderTest {
/// some code
@Test
public void testIt() throws Exception {
}
}
运行此命令时mvn test
我希望让maven运行测试FastHolderTest 但它没有:
[INFO] --- maven-surefire-plugin:2.19:test (default-test) @ core ---
[INFO] Tests are skipped.
我应该验证什么来找出为什么没有
# 1 楼答案
看起来你至少犯了一个拼写错误,@Category注释中的类读作了POM中的FastHolder,而FastHolder