Jmeter - Execute sampler once per test

我们两清 提交于 2020-01-06 04:33:10

问题


I have below test plan in my jmeter

|Test Plan
|-Thread Group
|--HTTP Request 1
|--HTTP Request 2
|--HTTP Request 3

In Thread Group I have setted:

  • Number of Threads - 5
  • Ramp-Up Period (in seconds) - 0
  • Loop Count -1

When I run my test Jmeter executes each request five times. I'm looking for way how to execute each sampler only once in whole test run, I know I can achive it by setting Number of Threads to 1, but in that case execution of test will be very slow, so I would like to do this in parallel way.

Any ideas how can I do it ? I know I can't use Only Once Controller because each request is also executed by each thread.


回答1:


You don't need more than 1 thread, you can add JMeter plugin bzm - Parallel Controller

Add it as the parent of the three request and it will execute it in parallel




回答2:


  1. Put your requests under the Switch Controller
  2. Use ${__threadNum} function as the "Switch Value"

Scenario outline:




回答3:


Take a look at the Once Only Controller this controller runs once per testrun. "The Once Only Controller will now execute always during the first iteration of any looping parent controller"




回答4:


Another option is use Throughput Controller as the parent of each request

Throughput Controller allows the user to control how often it is executed.

Choose Total executions with Throughput value 1

Total executions causes the controller to stop executing after a certain number of executions have occurred.

It will execute only once each request as you needed



来源:https://stackoverflow.com/questions/52149578/jmeter-execute-sampler-once-per-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!