Perform Performance/Load Testing Using Selenium

|
| By Webner

We can perform load testing in selenium using thread Pool Size and invocationCount attributes of Test annotation.
ThreadPoolSize will create a pool of threads with the help of which test method can be run via multiple threads.

For Example: if we want to run a test method for 15 times we can do that with following code that created 5 threads at a time (and will repeat the process 3 times to test 15 times):

import org.testng.annotations.Test;
public class ABC {
@Test(invocationCount=15, threadPoolSize=5)
public void runTest(){
System.out.println("ID of Thread is: "+Thread.currentThread().getId());
}

Leave a Reply

Your email address will not be published. Required fields are marked *