TestNG : Java Testing Next Generation :: Duration Timeout Example
TestNG Duration Timeout Example |
The “Time Test” means if an unit test takes longer than the specified number of milliseconds to run, the test will terminated and mark as failed.
package com.javaskool;
import org.testng.annotations.Test;
public class TestExample {
@Test(timeOut = 2000)
public void infinityMethod() {
//while (true);
try
{
Thread.sleep(1500);//change 1500 to 500
}
catch(InterruptedException e)
{
System.out.println(e);
}
}
}
Downloads Examples |
Recent Comments