官术网_书友最值得收藏!

  • 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.

  1. Launch JMeter.
  2. Open the ch1_add_timers.jmx test script located in the scripts/ch1 directory.
  3. Add Gaussian Random Timer by navigating to Test plan | Add | Gaussian Random Timer.
  4. Change Deviation (in milliseconds) from 100 to 1000.
  5. Change Constant Delay Offset (in milliseconds) from 300 to 500.
  6. 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.

主站蜘蛛池模板: 武清区| 织金县| 灵台县| 霍林郭勒市| 厦门市| 甘孜县| 濮阳县| 独山县| 宁河县| 普兰店市| 全州县| 庆城县| 伊吾县| 黄骅市| 津南区| 阳曲县| 吉木萨尔县| 厦门市| 甘肃省| 永善县| 东乌珠穆沁旗| 溧水县| 比如县| 荣昌县| 阿拉善盟| 陇南市| 通州区| 庆云县| 新化县| 建阳市| 焦作市| 永善县| 宝丰县| 额济纳旗| 永康市| 五莲县| 庆安县| 芷江| 博兴县| 上饶市| 巴楚县|