TestNG超时测试

用@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);
    }
}

上面的测试用例一条执行成功,一条执行失败

posted @ 2018-11-22 18:32  那心之所向  阅读(632)  评论(0编辑  收藏  举报