Showing posts with label How to execute a test case multiple times or use of 'invocationCount'. Show all posts
Showing posts with label How to execute a test case multiple times or use of 'invocationCount'. Show all posts

Thursday, May 15, 2014

How to execute a test case multiple times or use of 'invocationCount'

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