黄瓜等级-如何在运行时覆盖黄瓜标签

时间:2018-11-01 00:44:26

标签: gradle cucumber gradle-task

我有jUnit运行器类,可以在其中带有gradle的afterclass和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中的黄瓜标签选项在运行时运行此类。我该怎么办?

0 个答案:

没有答案