我有一个包含多个模块和一个常见父模块的maven项目。在这个项目中,有一些单元测试和Junit一起运行,以及BDD Cucumber集成测试。我想运行两个独立的作业,一个运行所有单元测试,另一个运行BDD /集成测试。为了做到这一点,我已经注解我BDD亚军类有一个Junit的类别标注,像这样:通过Maven运行Junit类别的黄瓜测试
@RunWith(Cucumber.class)
@CucumberOptions(
tags = { "@ATagToBeRun", "[email protected]","[email protected]" },
dryRun = false, strict = true,
features = "src/test/resources/cucumber/testing",
glue = { "com.some.company.test",
"com.some.company.another.test"})
@Category(value = IntegrationTest.class)
public class FlowExecutionPojoTest {
}
我创建父pom
Maven的配置文件,它使用maven-surefire-plugin
功能,是为了在过滤试验基地组。这里是我的Maven配置:
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-spring</artifactId>
<version>1.2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<profile>
<id>testJewels</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
<module>../my-module</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<groups>com.some.company.IntegrationTest</groups>
</configuration>
</plugin>
</plugins>
</build>
</profile>
我希望那是什么,当我运行mvn test -PtestJewels
与包含在<groups>
标签类别注释的类应该执行。实际上没有任何注释类被执行。
值得注意的一点是,当我使用maven-surefire-plugin
版本2.18这个工作,但从版本2.18.1,并没有。按照documentation在页面的底部,有在被继承类关于版本2.18.1但在我的情况下,他们在
你能分享你的pom依赖吗? cucumber-java,cucumber-junit软件包? – eg04lt3r
@ eg04lt3r确定的事情,将其添加到问题 – Jewels