在所有黄瓜测试后运行

use*_*341 8 java testing automated-tests cucumber

在运行所有黄瓜测试后,有没有办法运行方法?

@After 注释会在每个单独的测试之后运行,对吗?我不想只运行一次的东西,而是在最后。

Mor*_*der 11

您可以使用标准的 JUnit 注释。

在你的跑步者课上写一些类似的东西:

@RunWith(Cucumber.class)
@Cucumber.Options(format = {"html:target/cucumber-html-report", "json-pretty:target/cucumber-json-report.json"})
public class RunCukesTest {

    @BeforeClass
    public static void setup() {
        System.out.println("Ran the before");
    }

    @AfterClass
    public static void teardown() {
        System.out.println("Ran the after");
    }
}
Run Code Online (Sandbox Code Playgroud)