testng + Ignore 忽略測試方法


使用testng的時候,有時候會忽略掉某些測試方法,暫時不跑,簡單整理一下一些方法.轉載還請說明下

1.使用@Test(enable=false)方法

 1     @Feature("查詢")
 2     @Test(description = "驗證根據檔案號查詢功能",enabled = false)
 3     @Parameters({"fileNo", "searchfileNo"})
 4     public void TC_searchByFileNo(String fileNo, String searchfileNo) throws IOException {
 5         employeeInfoListPageActions.modifyMenu();
 6         employeeInfoListPageActions.searchByFileNo(fileNo);
 7         for (int i = 0; i < employeeInfoListPageActions.getSearchData(searchfileNo).size(); i++) {
 8             Assertion.VerityCationString(employeeInfoListPageActions.getSearchData(searchfileNo).get(i), fileNo);
 9         }
10     }
View Code

2.使用@Ignore方法,此方法針對整個測試類

此方法需要testng版本在6.14.2以上

直接在類上添加該方法

1 @Ignore
2 public class xxx{
3 }
View Code

 

3.在testng.xml文件中做操作,添加 enable="false"

4. 使用exclude方法,忽略單個測試方法

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM