Selenium_博客已迁移接口自动化测试测试自动化_博客已迁移

(七)TestNG学习之路—注解详述之忽略测试

2018-09-03  本文已影响14人  Tomandy

前言

前面文章提到了@Test的enabled属性,设置为false的话,执行测试会忽略@Test注解的方法。该篇文章将介绍TestNG的另一个注解@Ignore,也用于忽略测试,但其比@Test
的enabled属性功能更强大。

@Ignore

应用场景

import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
 
@Ignore
public class TestcaseSample {
 
    @Test
    public void testMethod1() {
    }
 
    @Test
    public void testMethod2() {
    }
}
@Ignore
package com.testng.master;
 
import org.testng.annotations.Ignore;

如上所示,com.testng.master及其子package下的所有测试方法都将被忽略执行。

上一篇 下一篇

猜你喜欢

热点阅读