我需要在执行另一个测试方法(testB
)后立即执行testNG测试方法(testA
)。另外我想用 @Test
注释 testA 因为我想告诉 testNG 它是一个测试方法而不是配置方法。
我可以使用@AfterMethod
,但 testNG 将 testA 视为我不希望的配置方法。
此外,我需要在执行 testB 后立即执行 testA。我不想在两者之间运行另一个测试。我该怎么做呢?
最佳答案
使用
@Test (dependsOnMethods={"methodB"})
public void methodA () {
}
另请参阅 http://testng.org/doc/documentation-main.html#dependent-methods
关于java - 如何在执行另一个测试后立即执行另一个测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33460463/