Tutorial 10
Tutorial 10
Tasks
Task 1: A basic performance test
Choose your favorite website to conduct this performance testing. Create one script to test this website by
following these steps:
Create and configure Thread Groups. A Thread Group represents a group of virtual users that will
execute your test scenario.
o Number of Threads: Each thread simulates one user.
o Ramp-up Period: Time (in seconds) JMeter should take to create all threads.
o Loop Count: How many times each thread should execute the test scenario.
Create and configure Samplers. Samplers are the elements that perform the actual requests to
your target server. HTTP Request sampler is most common for website testing. Configuration
includes:
o Server name/IP
o Port number
o Protocol (HTTP/HTTPS)
o Method (GET, POST, etc.)
o Path
o Parameters/body data
Create and configure Timers. Timers add delays between requests to simulate realistic user
behavior. Without timers, JMeter would execute requests as fast as possible, which might not
represent real user behavior. The timer types are:
o Constant Timer: Adds a fixed delay between requests
o Gaussian Random Timer: Adds random delays based on a normal distribution
o Uniform Random Timer: Adds random delays within a range
o Throughput Timing: Controls requests per minute
Create and configure Listeners (View Tesults Tree). Listeners collect and display test results in
various formats.
o View Results Tree: Shows detailed information for each request
o Aggregate Report: Provides summary statistics (response times, throughput, error
rates)
o Graph Results: Displays graphical representation of performance metrics
o Summary Report: Shows basic statistics in tabular format
Save the test as .jmx file
Finally, run and view result
1. Right-click on "Test Plan" > Add > Threads > Thread Group
2. Configure your Thread Group (users, ramp-up, loops)
3. Right-click on Thread Group > Add > Sampler > HTTP Request
4. Configure your HTTP Request with target website details
5. Right-click on Thread Group > Add > Timer > Constant Timer
6. Configure timer (e.g., 300ms delay between requests)
7. Right-click on Thread Group > Add > Listener > View Results Tree
8. Run the test (green play button)
Example: Let’s test a flight booking website. The first script simply searched for flights, this script will
search, then choose a flight.
When you search for a flight in your web browser, and click the “Choose This Flight” button beside the
flight of your choice, note that the next page adds a "/reserve.php" to the URL.
With this in mind, go back to JMeter and add another HTTP Sampler. This time, you’ll not only specify
"website.com", but you’ll add "reserve.php" to the “Path” field. Doing so tells the sampler to build a
full URL of "website.com/reserve.php". Next, add the parameters required to make the selection. To
complete the choice, this page requires you specify a fromPort and toPort, which you’ll designate
“Boston” and “London”, respectively.
Through your Chrome, start recording and simulate the user scenario you want to test by clicking away.
When you’re done, stop the recording, and edit as necessary.
Export your recording to JMX. Don’t forget to move the downloaded script to your preferred folder.
Open the .jmx file file in JMeter. You will be able to see your test plan, which was created from the
recording and the .jmx file.
Note that this plan has new elements, like Cookie Manager and Cache Manager. They are here because
browsers keep cookies and cache, and they were captured in the recording. You can clear them up if you
need to. These entirely optional elements are present to simulate web browser behavior more closely.
Submission
Submit your Performance Testing Report (the .docx file) to the submission box of this tutorial. The
Report should contain important screenshots of the performance/load testing that you performed in the
activities of this tutorial.