九、TestNG超时测试

“超时”表示如果单元测试花费的时间超过指定的毫秒数,那么TestNG将会中止它并将其标记为失败。

使用属性 timeOut = 参数(1s*1000)

package com.lc.testngChaoShi;

import org.testng.annotations.Test;

public class testNG13 {
  
    @Test(timeOut = 5000)  //5000 表示  5秒
    public void testNG13_01() throws InterruptedException {
        Thread.sleep(6000);
    }
}

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