- JMeter Cookbook
- Bayo Erinle
- 289字
- 2021-08-05 17:36:27
Using timers
By default, when test scripts are recorded in JMeter, they contain no pauses between page requests. This is sometimes known as the think time in test scripts. In reality though, most users will frequently pause for a duration of time on every page before moving on to another page in the application. In JMeter, the ways to achieve these pauses are through timers. JMeter comes with a wealth of timers to achieve this purpose.
How to do it…
In this recipe, we will show you how to mimic realistic user behaviors using the JMeter timers.
- Launch JMeter.
- Open the
ch1_add_timers.jmx
test script located in thescripts/ch1
directory. - Add Gaussian Random Timer by navigating to Test plan | Add | Gaussian Random Timer.
- Change Deviation (in milliseconds) from
100
to1000
. - Change Constant Delay Offset (in milliseconds) from
300
to500
. - Save and execute the test script.
How it works…
With our configuration, each thread will pause for a duration of 0.5
to 1.5
seconds after each request before proceeding to the next request. This is because we applied the timer at the root level of the test plan. If we wanted to have pauses after each logical page rendering, we will add a timer at the transaction controller level. This option is mostly what you will go with as a single rendered web page often consists of multiple requests.
There's more…
There are many more timers that come bundled with JMeter even through additional plugins that serve different purposes. There are timers that simulate constant delay, constant throughput, random delay, and so much more. Depending on your use case and what you are trying to simulate, you will choose one or several of these.
- MySQL基礎(chǔ)教程
- 數(shù)據(jù)結(jié)構(gòu)與算法(C語言版)
- 達(dá)夢數(shù)據(jù)庫性能優(yōu)化
- 數(shù)據(jù)庫原理與應(yīng)用(Oracle版)
- 數(shù)字媒體交互設(shè)計(初級):Web產(chǎn)品交互設(shè)計方法與案例
- MySQL 8.x從入門到精通(視頻教學(xué)版)
- 計算機應(yīng)用基礎(chǔ)教程上機指導(dǎo)與習(xí)題集(微課版)
- 新手學(xué)會計(2013-2014實戰(zhàn)升級版)
- 活用數(shù)據(jù):驅(qū)動業(yè)務(wù)的數(shù)據(jù)分析實戰(zhàn)
- Doris實時數(shù)倉實戰(zhàn)
- 數(shù)據(jù)應(yīng)用工程:方法論與實踐
- 大數(shù)據(jù)測試技術(shù):數(shù)據(jù)采集、分析與測試實踐(在線實驗+在線自測)
- Unity for Architectural Visualization
- 大數(shù)據(jù)隱私保護(hù)技術(shù)與治理機制研究
- 深入理解Flink:實時大數(shù)據(jù)處理實踐