Jmeter > | used for load Testing & Stress testing, under testing strategy called Performance Testing. | JMeter is a pure Java desktop application. It requires a fully compliant JVM 6 or higher. You need to download and install the Jdk8 version of Java SE Development Kit or Amazon Corretto 1.8 which is equivalent to Java 8. | 1. Go for Test Plan in JMeter 2. Add Thread Group (number of Users, total time to complete all threads, number of time such requests repeates) and 3. Add Sampler (Http Request) 4. Add Assertion if any and Add Listener (single or mutiple) 5. Click on run. Request goes to server and response recorded in Listener. 6. Results can be analyse in the form of graphs, tables, tree etc | ||||||
Test Plan :- | Run Thread Groups consecutively – one at a time | ||||||||
Run tearDown Thread Groups – this thread will run after the main test execution. | The tearDown feature is generally used for reporting or cleaning operations – It’s similar to a normal Thread Group but executes post-test activities, such as cleaning up test data or restoring the system to its initial state. | Two test plan can be combined with merge option | |||||||
Thread Group :- | Thread Groups is a collection of Threads. Each thread represents one user. Simulates number of users requesting to server | Number of Threads = number of users, Ramp-up period = total time to take to make all thread up & running – total seconds/total threads = time at which each thread start after the previous one, Loop count = number of times request sent by each user | select Same user on each iteration, ( If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun.) | ||||||
Samplers :- | FTP Request > Download or Upload File | ||||||||
HTTP Request > In Response, Receive HTML or Image/data from website | |||||||||
JDBC Request > Send SQL query & receive result | (Java Datatbase Connectivity) | ||||||||
SMTP Sampler > Test Mail server by sending mails | (Simple Mail Transfer Protocol) | ||||||||
Access Log Sampler > gets an access log file which records the requests users make to the a web application. Usually, each entry in the Access Log contains a server address, a user machine address, a request, a corresponding timestamp and a response code with a response message. | |||||||||
Assertions :- | Verifies that server under test returns the expected result :- | Response Assertion > | Main sample and sub-samples > Response Code > contains > 200 | ||||||
Duration Assertion | |||||||||
Size Assertion | |||||||||
Xml Assertion | |||||||||
HTML Assertion | |||||||||
Config Elements :- | Setup defaults or variables for samplers :- | ||||||||
CSV Data Set Config > Jmeter read lines from text file and split them into variables | |||||||||
HTTP Cookie Manager > act like browser cookie. It store cookie use that to send HTTP request to server wrt that specific user | |||||||||
Login Config Element > add username & password in sampler | |||||||||
HTTP Request Defaults > have server parameters/query Params to send HTTP requests | |||||||||
Listeners :- | Shows the result of test execution in formats like Tree, Table, Graph or Log file. :- | Tree > show user request in basic HTML format | |||||||
Table > show result in table | |||||||||
Graph > show result in graphical form | |||||||||
Log file > show result in text file | |||||||||
Miliseconds (Time Duration) | Miliseconds (Actual Action Duration) | ||||||||
Load time > | Time between just before sending the request to just after receiving the last part of the response. (A) | 785 | 45 | < Response fetched in (A) – (B) | |||||
Latency > | Time between just before sending the request to just after receiving the first part of the response (B) | 740 | 518 | < Actual Latency by less connect time (B) – (C) | |||||
Connect time > | measures the time it took to establish the connection, including SSL handshake. Note that connect time is not automatically subtracted from latency. (C) | 222 | |||||||
Size in bytes : | Header Size + Body Size | 20781 | 20781 | (D) + (E) | |||||
Header Size : in bytes | Headers contain url, Payload (user data), client data (OS, Browser data, proxy data), token, querryParam, Response Header ( contains Server Location, Cookies) (D) | 1209 | |||||||
Body Size : in bytes | User Inputa data, Response body data contains result, Json like Image/pdf etc in encryted format (E) | 19572 | |||||||
Sent bytes | that data a client sends to a server when making a request | 119 | |||||||
Median | It is the Value under which 90 Percent of the examples fall. like 90% call complete in this miliseconds | 792 | |||||||
Average | It is used to specify how much time is taken by a specific request. Time (miliseconds) taken on average to complete API Call | 930 | Elapsed time = ramp up time ? | ||||||
Throughput | Number of request handles / minute | 391.7/minutes OR | 6.52 / seconds | Throughput in seconds * Elapsed time = Total number of User | 6.5 * 30 = 200 Users | no. of request/Elapsed time (ms) * 1000 = throughput/sec => | 6.67 | ||
Latest Sample | Time taken to complete call by last sample in test plan | 775 | |||||||
Deviation (from load time) | Diff. from set value in miliseconds, If the deviation value is low, it means the system is not under stress. It is basically the more time taken by api call from set value in seconds. Deviation shows how much the server response time varies, a measure of degree of dispersion | 392 | |||||||
Thread vs sample | Thread is number of users & sample is total number of request made by users |