load testing how to code example

Example: load testing

By combining both TestNG multiple threads and Selenium powerful 
browser automation. You can create a simple yet powerful load 
test

Public class TestMultipleThreads {
    
  @Test(invocationCount = 100, threadPoolSize = 5)
  public void loadTest() {

    System.out.printf("%n[START] Thread Id : %s is started!", 
                                  Thread.currentThread().getId());
        
    WebDriver driver = new FirefoxDriver();
    driver.get("http://yourwebsite.com");
        
    //perform whatever actions, like login, submit form or navigation
        
    System.out.printf("%n[END] Thread Id : %s", 
                                  Thread.currentThread().getId());
        
    driver.quit();

Tags:

Misc Example