Note- invocationCount , this determined how many times the test case should execute.
ex- This will execute 5 times.
import org.testng.annotations.Test;
public class RunTestMultipleTimes {
@Test(invocationCount=5)
public void runMultipleTimes(){
System.out.println("run this test");
}
}
Output
---------
run this test
run this test
run this test
run this test
run this test
PASSED: runMultipleTimes
PASSED: runMultipleTimes
PASSED: runMultipleTimes
PASSED: runMultipleTimes
PASSED: runMultipleTimes
ex- This will execute 5 times.
import org.testng.annotations.Test;
public class RunTestMultipleTimes {
@Test(invocationCount=5)
public void runMultipleTimes(){
System.out.println("run this test");
}
}
Output
---------
run this test
run this test
run this test
run this test
run this test
PASSED: runMultipleTimes
PASSED: runMultipleTimes
PASSED: runMultipleTimes
PASSED: runMultipleTimes
PASSED: runMultipleTimes
Good collection of working examples:-)
ReplyDelete