【发布时间】:2015-02-26 05:38:20
【问题描述】:
我对在 testNG 中使用注释 @beforeClass、afterClass、beforeSuite、afterSuite 感到困惑。
我了解以下测试结构:
package mytestNG.learning.it ;
public class sample_not_working {
@Test
//take action - click on links, input data etc
public void main() {
}
@BeforeMethod
//do stuff like setup browser etc
public void beforeMethod() {
}
@AfterMethod
//close browser
public void afterMethod() {
}
}
但是你在课前、课后和测试中做什么呢?它是什么文件? 是运行其他类的类吗?
Next、afterSuite、beforeSuite 和 @test:
public class sample_not_working {
@Test
public void main() {
//WHAT KINDA CODE YOU PUT HERE?
}
@BeforeSuite
//WHAT KINDA CODE YOU PUT HERE?
public void beforeMethod() {
}
@AfterSuite
public void afterMethod() {
//WHAT KINDA CODE YOU PUT HERE?
}
}
我的问题是关于语义、意义,而不是实际代码。我阅读了 testNG 文档 - 没有帮助。
【问题讨论】:
标签: unit-testing testing webdriver testng