TestNG笔记

使用前要引用testng的库(我没引也可以用,就把eclise配置了testng而已见 https://www.cnblogs.com/kaibindirver/p/12150455.html)

后记: 确定得导包,并且注意maven得导包代码中要把 <scope>test </scope>去掉,不然导包不全,参考: https://blog.csdn.net/jiuweihu521/article/details/85293234

好像这2种都是包,后面再研究下

 

一、常规套路 参考:https://www.yiibai.com/testng/basic-annotations.html

//测试用例

@Test

public void testTwo(){

System.out.print("lucax02");

}

 

//每个用例执行前执行

@BeforeMethod

public void beforeMethod(){

System.out.println("Before Method");

}

 

//每个用例执行后执行

@AfterMethod

public void afterMethod(){

System.out.println("After Method");

}

 

 

//套件运行前仅执行一次

@BeforeSuite
public void beforeSuite(){
System.out.println("Before Suite Method");
}


//套件运行后仅执行一次
@AfterSuite
public void afterSuite(){
System.out.println("After Suite Method");
}

posted @ 2020-01-06 10:45  凯宾斯基  阅读(138)  评论(0编辑  收藏  举报