loading test code example
Example 1: load testing
It is to verify that the system/application
can handle the expected number of transactions
and to verify the system/application
behavior under both normal and peak load conditions.
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()
Example 2: 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();