@author: Saksham Varshney
Performance Testing is a type of testing to ensure software applications will perform well under the particular workload
1. Load Testing
2. Stress Testing
3. Volume Testing
4. Endurance Testing
5. Spike Testing
6. Scalability Testing
1. Script runs in headless mode
2. Script will run for 1k, 10k or more times depend upon our configurations
1. JMeter
2. Load Runner
3. New Load
4. Load UI
1. It is the most popular Load Test Tool
2. It is Open Source & free of cost tool
3. Built on Java
4. GUI is more user-friendly
5. Cross Plateform Support
1. Download Binaries-zip file
2. Make sure to have require java version
3. Extract the JMeter zip file
4. Go to bin >> Launch the application
Perform set of steps on browser and JMeter will listen those steps and write script for us
Steps:
- Click on Test Plan >> Add >> Non Test Elements >> HTTP(s) Test Script Recorder
- Need to configure the port number [suppose 8888]
- Need to configure Test Plan Creation >> Target Controller
A thread group is a set of threads executing the same scenario
Some other thread groups:
Prerequisite: Need to install Jmeter Plugin Manager
Other Thread Groups:
- Concurrency Thread group: Contains following parameters
- Target Concurrency
- Ramp Up Time
- Ramp-Up Steps Count
- Hold Target Rate Time
- Ultimate Thread group: Contains following parameters
- Start Threads Count
- Initial Delay
- Startup Time
- Hold Load For
- Stutdown Time
-
Samples: No of users hit that specific request
-
90%ile: 90% of the samples took no more than this time. The remaining samples took at least as long as this (90th percentile)
-
Average transition value: It is the average time taken by all the samples to execute specific label
-
Error %: Percentage of Failed requests per Label
-
Throughput:
- Throughput is the number of request that are processed per time unit(seconds, minutes, hours) by the server
- This time is calculated from the start of first sample to the end of the last sample
- Larger throughput is better
Cookie Manager: It is use to store the cookie [Auth token/key] of transition like any application login page
- Aggregate Report
- Graph Results
- View Results tree
- Response Assertion:
- Status code Assertion
- Response text Assertion
- Size Assertion
- Controller is simply a container/folder that can store multiple requests
- It is use to categorize request in good manner
Different Types of Controller:
- Recording Controller: It is simply use to record the requests
- Transaction Controller: It is use to represent the parent request [Controller Name] in Aggregate Result Report
- Simple Controller: The parent rquest [Controller Name] is not displayed in Aggregate Result Report
- Module Controller: It is use to re-use the controllers script requests again without recording / copy paste the same requests
- Interleave Controller: One sampler per Iteration is executed in top to bottom order
- Runtime Controller: Runtime Controller controls the execution of its samplers/requests for the given time
- Random Controller: Random Controller plays only one of its children samples picking it randomly
- IF Controller: It is condition based controller, if the curtain condition matches/passes then only execute that particular request
- Loop Controller: It is same as Runtime Controller but the difference is request getting execute as per number of loop count not per time count
- While Controller: Samples getting execute until condition becomes false
- Constant Timer:
- Gaussian Random Timer: Constant Time + Deviation Time
- Poisson Random Timer: Constant Time + Lambda Time
- Costant Throughput Timer: It can restrict the request processed per time
Regular Expression Extractor:
- It is use when need to grab data from the site itself and use that data in next steps in test
- Generally use as post-proceessor
Question: Can we use single Regular Expression Extractor to extract or grab the multiple data ?
Answer: Yes
Debug Sampler: It is the place we can see all the variables used during the whole test
Data Driven Testing: It simply means get data from csv file
1. Launch cmd via Administratative mode
2. go to apache bin directory
3. Run "jmeter -n -t testname.jmx -l results.jtl" command on cmd
Note:
Give filename with path if script is not present in bin directory
n: non GUI mode
t: testplan
l: store results
There are certain limitations to the number of users you can run, with the CPU memory and RAM Configuration for a single machine so it is use to distribute the load
Setup steps:
In Slave Machine:
- Go to bin directory > Open jmeter.properties
- Make this "server.rmi.ssl.disable" config unhide and true
- Launch the jmeter-server.bat
- It will show "Created remote object" on some ip statement on cmd
- Remember the IP address of slave machine
In Master Machine:
- Go to bin directory > Open jmeter.properties
- Make this "server.rmi.ssl.disable" config unhide and true
- Give this "remote_hosts" config the IP address of slave machine
- Launch the JMeter application and start the test on Remote server as Click on Run from top menu > Click Remote Start > Select the Slave Machine IP Address
Pre-cautions:
- Both Master & Slave machines must run the same Jmeter version
- Both Master & Slave machines must be on the same subnetwork(wifi)
- Both Master & Slave machines should be as similar as possible: same OS, same directory tree, etc
Scenario: Need to add/append india in username if country is india
String newUsername;
log.info(vars get("country"));
String country= vars.get("country");
if(country.equals("india")
{
newUsername= vars.get("username")+"india";
vars.put("username", newUsername);
}
Sample jmx file:
- Download the both files [jmx & csv] from below google drive link
- Put these downloaded files in same folder to avoid wrong csv file directory in script
Files link: Click here to download the files
Note: File is restricted in access, please request to access these files





