TestNG超时测试

2019-07-26  本文已影响0人  Lutous
@Test(timeOut = XXX) 指定超时时间,单位是毫秒
package com.janson;

import org.testng.annotations.Test;

public class TimeOutTest {

    @Test(timeOut = 3000) //毫秒
    public void testSuccess() throws InterruptedException{
        Thread.sleep(2000);
    }

    @Test(timeOut = 2000)
    public void testFailed() throws InterruptedException{
        Thread.sleep(3000);
    }
}

执行结果一条执行成功,一条执行失败
参考:https://www.cnblogs.com/janson071/p/10002914.html

上一篇 下一篇

猜你喜欢

热点阅读