- testNG忽略测试,跑测试用例时忽略暂时不执行的方法
在@Test注释后添加false属性,不手动添加时默认是true
package com.ngtest.suite;
import org.testng.annotations.Test;
public class ignoreTest {
@Test //有test标签一定会被测试到,默认的属性是true
public void ignore1(){
System.out.println("ignore1 执行");
}
@Test(enabled = false)
public void ignore2(){
System.out.println("ignore2 执行");
}
}
运行结果为:ignore1 执行
2.testNG组测试:方法分组归类测试
在@Test后添加groups的属性
package com.ngtest.groups;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.Test;
public class GroupsOnMethod {
@Test(groups = "server")
public void test01(){
System.out.println("这是服务端组的测试方法111");
}
@Test(groups = "server")
public void test02(){
System.out.println("这是服务端组的测试方法222");
}
@Test(groups = "client")
public void test03(){
System.out.