Use of InvocationCount in TestNG

By using of invocationCount  we can execute a test multiple times.
Invocation count determines how many times test will execute.

For EX: Execute test 7 times

import org.testng.annotations.Test;

public class MultipletimesRun {
    @Test(invocationCount=7)
    public void multipleTimesRun(){
        System.out.println("Execute 7 times");
    }
}

Output :

Execute 7 times
Execute 7 times
Execute 7 times
Execute 7 times
Execute 7 times
Execute 7 times
Execute 7 times
PASSED: multipleTimesRun
PASSED: multipleTimesRun
PASSED: multipleTimesRun
PASSED: multipleTimesRun
PASSED: multipleTimesRun
PASSED: multipleTimesRun
PASSED: multipleTimesRun

No comments:

Post a Comment

Copyright © 2017 QALEARNINGGUIDE.COM || ALL RIGHTS RESERVED