load test code example
Example 1: what is load testing
What is Load testing?
Load testing is the process that simulates actual user
load on any application or website. It checks how the
application behaves during normal and high loads.
This type of testing is applied when a development
project nears to its completion.
Load testing is performed to determine how many
users the system can handle.
Example 2: 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 3: 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();