【发布时间】:2018-04-11 03:55:06
【问题描述】:
当我使用“Run as Junit Tests”运行黄瓜测试时,测试使用适当的标签正常运行。
当我使用“Maven”运行黄瓜测试时,测试运行正常带有适当的标签,前提是我在运行器类中提到了标签。
@Cucumber.Options(format={"pretty", html:target/cucumber","json:target/cucumber.json"},tags= {"@smokeTest"})
但我希望能够将标签作为参数提供给 mvn test 命令,以运行测试用例,并且我正在使用以下命令。
mvn test -Dcucumber.options="--tags @tagTest"
但不管我的标签如何,它都会运行所有测试用例。
当我使用命令 mvn test -Dcucumber.options="--tags @tagTest"
我在我的跑步者课上没有提到任何标签
@Cucumber.Options(format={"pretty",html:target/cucumber","json:target/cucumber.json"})
请让我知道我哪里出错了?
这是 runnerTest 代码:
import org.junit.runner.RunWith;
import cucumber.junit.Cucumber;
@RunWith(Cucumber.class)
@Cucumber.Options(format={"pretty", "html:target/cucumber","json:target/cucumber.json"})
public class runnerTest {
}
附上
【问题讨论】:
-
不确定这是否有帮助,但是当为 maven 命令提供选项时,它会覆盖 runner 类中提到的所有选项。
-
@Grasshopper 是的,所以我希望当我使用命令 test -Dcucumber.options="--tags @smokeTest" 时,它应该能够运行并仅触发一个测试用例带有标签smokeTest
标签: maven testing tags cucumber continuous-testing