我使用 CucumberTestSuite 文件设置了一个宁静框架,其中包含以下内容:
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
tags = "@test",
plugin = {"pretty"},
features = "src/test/resources/features"
)
public class CucumberTestSuite {
}
然后在每个功能文件中,我用 @test 标记场景,当我运行 mvn clean 时,验证所有标记为 @test 的场景运行。我想为某些环境添加冒烟测试,所以我想我可以将@smoke 添加到场景中并通过调用只运行冒烟
mvn clean verify -Dcucumber.options="--tags @smoke"
但是,不幸的是,所有测试似乎都在运行。有没有办法只运行特定的标签,而 CucumberTestSuite 在其@CucumberOptions 中有一个标签,或者我必须从文件中删除标签并始终通过
调用测试mvn clean verify -Dcucumber.options="--tags @smoke"
或
mvn clean verify -Dcucumber.options="--tags @test"?
A
我看错了建议。看到很多帖子说我用
mvn clean verify -Dcucumber.options="--tags @smoke"
但是正如我上面所说,这会导致所有测试都在运行。而是使用:
mvn clean verify -Dcucumber.filter.tags="@smoke"
这将只运行带有 smoke 标记的测试
A