In my previous post, I explained how to run a test method ‘n’ number of times by setting invocationCount property. You can even run the test method in parallel by setting threadPollSize property.
@Test(invocationCount = 10, threadPoolSize = 3)
public void a() {
}
InvocationCountParallelTest.java
package com.sample.app.tests;
import org.testng.annotations.Test;
public class InvocationCountParallelTest {
@Test(invocationCount = 10, threadPoolSize = 3)
public void a() {
System.out.println("Executed by " + Thread.currentThread().getName());
}
}
Run ‘InvocationCountParallelTest.java’, you will see below messages in console.
Executed by TestNG-methods-2
Executed by TestNG-methods-3
Executed by TestNG-methods-1
Executed by TestNG-methods-2
Executed by TestNG-methods-1
Executed by TestNG-methods-3
Executed by TestNG-methods-2
Executed by TestNG-methods-2
Executed by TestNG-methods-1
Executed by TestNG-methods-3
No comments:
Post a Comment