码迷,mamicode.com
首页 > 其他好文 > 详细

TestNG超时测试

时间:2018-11-22 19:00:33      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:测试   oid   throws   imp   port   xxx   led   public   rup   

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

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

TestNG超时测试

标签:测试   oid   throws   imp   port   xxx   led   public   rup   

原文地址:https://www.cnblogs.com/janson071/p/10002914.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!