Thursday, May 15, 2014

How to do the performance or load testing using selenium.

Note- Use threadPoolSize and invocationCount attribute.
The threadPoolSize attribute tells TestNG to create a thread pool to run the test method via multiple threads. With thread pool, it will greatly decrease the running time of the test method.


Ex- Start a thread pool, which contains 4 threads, and run the test method 12 times.

import org.testng.annotations.Test;

public class PerformanceTesting {
    @Test(invocationCount=12, threadPoolSize=4)
    public void runTest(){
        System.out.println("Thread Id: "+Thread.currentThread().getId());
    }
}

2 comments:

  1. What is the use of invocationCount attribute?

    ReplyDelete
  2. Please find your ans here. Thanks!!

    http://selenium-makeiteasy.blogspot.in/search/label/%27invocationCount

    ReplyDelete