我有 jUnit runner 类来运行带有 gradle 的黄瓜,其中包含 before 和 afterclass。使用 cucumber.options="--tags@fix" 时,所有测试用例仍在运行。注意:我可以在 mvn 中覆盖它,但它在 gradle 中不起作用
@RunWith(Cucumber.class)
@CucumberOptions(monochrome = true,
plugin = {"pretty",},
glue = {"mobile/iag/com/au/stepdefs"},
tags = {"@fix","~@ignore"},
features = {
"src/test/resources/features/some.feature"}
)
public class RunCukesTest {
//public static String token;
static WireMockServer wm = new WireMockServer(options()
.port(8181)
.httpsPort(8282)
.keystorePath("src/test/resources/mock/cert/identity.jks")
.usingFilesUnderDirectory("src/test/resources/mock")
);
@BeforeClass
static public void beforeCucumberTestStart() {
PropertyConfig propertyConfig = new PropertyConfig();
if (!propertyConfig.isBatsEnv()) {
wm.start();
System.out.println("Starting Mock service.");
Utils.clearLogFile();
Utils.clearMockFile();
}
}
@AfterClass
static public void afterCucumberTestEnd() {
PropertyConfig propertyConfig = new PropertyConfig();
if (!propertyConfig.isBatsEnv()) {
wm.stop();
System.out.println("Stopping Mock service.");
}
}
我想通过覆盖gradle中的黄瓜标签选项在运行时运行这个类。我怎么做?