How to Build a Realistic Test Plan in JMeter
These tips will help you build a realistic test plan for JMeter to replicate a user in your web or mobile app using think time.
Join the DZone community and get the full member experience.
Join For FreeThe Proxy Server allows JMeter to record all the actions while the user browses web/mobile application. The recorded actions are stored under the test plan in JMeter.
The JMeter script should be prepared in a realistic way, e.g. by adding a delay between each user action, which we call Think time. Think time allows the virtual users/threads to pause between business flows while moving from one transaction to another. In real scenarios, users will never log in, search, place an order, pay, and log out within a few seconds, as the user needs some time to think and do the next action.
Including Think time in the test plan makes the performance test more realistic as it represents users’ actual behavior in the system.
Following are the steps for a realistic test plan:
- Create a new test plan, switch to WorkBench, and add HTTP(S) Test Script Recorder.
- Now, add Constant Timer to HTTP(S) Test Script Recorder and set Thread Delay (in milliseconds) in Constant Timer as ${T}. It tells the proxy server to record your delay time while you browse rather than adding a constant time.
- Now, configure your browser to use the JMeter Proxy and record the user actions of the web/mobile application.
- You can see that the requests are recorded with Constant Timer with the exact time delay.
Note: We need to remove the first sampler’s generated timer manually since the first sampler usually does not need one.
The timer will now record the user think time in a realistic scenario through the Proxy Server. Depending upon the application context, the think time will vary. It’s not advisable to have the default think time for all applications under test.
Opinions expressed by DZone contributors are their own.
Comments