用@Test(timeOut = XXX) 指定超时时间,单位是毫秒 package com.janson; import org.testng.annotations.Test; public class TimeOutTest { @Test(timeOut = 3000) // 毫秒 public void testSuccess() throws InterruptedException{ Thread.sl
用@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); } }
上面的测试用例一条执行成功,一条执行失败