Stress Testing web application with JMeter HTTP(S) Test Script Recorder
Introduction
1. Steps to Setup
Step 01: Download requirements.
- Download Java to your device. download java
- After successfully installing Java, download JMeter
- Extract the file and go to the file path \apache-jmeter-5.6.3\bin and open ApacheJMeter.jar
Step 02: Create Test Plan
Setting up the JMeter setup for recording test scripts correctly is crucial before beginning stress testing on a web application. With the help of Apache JMeter's integrated HTTP(S) Test Script Recorder, testers can record in-the-moment browser activity and turn it into test scripts. Later on, these scripts can be used to analyze system performance under load and simulate multiple users. This section involves setting up the HTTP(S) Test Script Recorder, adding necessary elements such a Thread Group and recording controller, and creating a new test plan in JMeter. This configuration serves as the basis for logging and running web requests, which will subsequently be utilized for application stress testing.
Step 03: Proxy setup
After setting up the basic JMeter Test Plan, the next step is to configure the proxy settings to enable the recording of browser requests. The HTTP(S) Test Script Recorder in JMeter works as a proxy server that captures all HTTP and HTTPS traffic between the browser and the web application. By default, it listens on port 8888.
To start recording user actions, the computer’s network proxy must be configured to route traffic through JMeter’s proxy port. Once the proxy is set up correctly, all browser interactions with the target web application will be recorded automatically into JMeter, allowing for accurate test script generation.
- Open Firefox.
- Launch the Firefox browser on your computer.
- Go to Settings.
- Click the menu icon (☰) in the top-right corner and select Settings (or Options on some versions).
- Search for Proxy Settings.
- In the Settings search bar, type “proxy” and click “Settings…” under Network Settings.
- Choose Manual Proxy Configuration. In the Connection Settings window:
- Select Manual proxy configuration.
- In the HTTP Proxy field, enter: localhost
- In the Port field, enter: 8888
- Apply Settings.
- Check the box “Use this proxy server for all protocols.”
- Confirm and Save.
- Click OK to save your proxy configuration.
Step 04: Browser setup
- Firefox visit about:preferences#privacy
- View Certificate>click import : apache-jmeter-5.6.3\apache-jmeter-5.6.3\bin\ ApacheJMeterTemporaryRootCA.crt
Step 05 : Recode testing
Step 06: Starting Testing
- Add> listener> Summery report
- Add> listener> View Result tree
2. JMeter Scripting and Configuration Best
Practices
Since the document is procedural, make sure it highlights the following
high-impact JMeter efficiency and accuracy tips:
Parameterization and Variables
·
Use Data Files (CSV Data Set Config):
Emphasize replacing hardcoded user credentials, IDs, or other session data with
variables pulled from a CSV file. This is essential for simulating unique
users and preventing user-blocking issues.
·
Use User Defined Variables (UDVs):
Suggest setting common configuration values (like the server IP and the protocol/port) in
the User Defined Variables element at the Test Plan level. This makes the
script easily maintainable if the environment changes.
Timers and Realism
·
Add Timers: Ensure the document specifies
using Timers (like Constant Timer
or Gaussian Random Timer) to
introduce a realistic delay between requests. This simulates a user's "think
time" and prevents aggressive request bursts that are unrealistic.
Response Validation
·
Use Response Assertions: While the
document mentions adding assertions, stress that they are vital. Response
Assertions must be used on every critical request to verify the response
content (e.g., checking for a specific success message or text). Without this,
a test might report a "200 OK" status code but be serving an
incorrect or error-laden page.
3. Test Execution Guidelines
The steps in your document regarding "Starting Testing" (Step 06)
should include explicit instructions on running the load test correctly.
·
Run in Non-GUI Mode: Crucially,
state that the actual load test must be executed from the command line
(non-GUI mode). Running in GUI mode consumes excessive memory and skews the
test results, especially under heavy load.
·
Disable Listeners: Instruct users to disable
or remove memory-intensive Listeners (like View Results Tree or View
Results in Table) during the load test run. The document
mentions a Listener for a summary; if it is an Aggregate Report, it should only be used for debugging or
post-run analysis. Data logging should be done to a .jtl file using the command
line flag, and reports generated after the test is complete.
Conclusion
Stress testing a web application using Apache JMeter and its HTTP(S) Test Script Recorder is an effective approach to evaluate system performance under extreme conditions. By capturing real user interactions and simulating heavy loads, testers can identify performance bottlenecks, scalability issues, and system limitations before they impact end users.
This process ensures that the application can maintain stability, responsiveness, and reliability even during peak usage. Configuring JMeter’s proxy recorder, creating an organized test plan, and executing stress scenarios provide valuable insights into the application’s capacity and recovery behavior.
Overall, stress testing with JMeter helps improve the quality and robustness of web applications, enabling development teams to deliver a more resilient and high-performing product.
Have a nice day! ✨
Comments
Post a Comment