在所有黄瓜测试后运行
答
您可以使用标准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");
}
}
答
使用TestNG套件的功能将正常工作。
@BeforeSuite
public static void setup() {
System.out.println("Ran once the before all the tests");
}
@AfterSuite
public static void cleanup() {
System.out.println("Ran once the after all the tests");
}
答
黄瓜的情景基础测试,您应该一步写自己的场景.feature
文件的步骤和这些步骤是由他们的步骤定义分别执行。
所以如果你想要在所有步骤之后发生一些事情,你应该在最后一步写出它,并在步骤定义中开发这一步骤。
另外,对于您想要在执行其他步骤之前要执行的操作,您应该在.feature
文件中的所有步骤之前考虑一个步骤,并在其步骤定义中对其进行开发。