八、TestNG忽略测试

一个TestNG  测试类中如果有的方法不想测试可以使用

enabled 属性

enabled = false  该方法不参与测试

enabled = true  该方法参与测试

@Test 不写enabled默认为true

package com.lc.testngHuLue;

import org.testng.annotations.Test;

public class testNG12 {
     
    @Test
    public void testNG12_01() {
        System.out.println("我是testNG12类的testNG12_01方法");
    }
    
    @Test(enabled = false)
    public void testNG12_02() {
        System.out.println("我是testNG12类的testNG12_02方法");
    }
    
    @Test(enabled = true)
    public void testNG12_03() {
        System.out.println("我是testNG12类的testNG12_03方法");
    }
}

运行结果

原文地址:https://www.cnblogs.com/fanfancs/p/14135745.html