Kamil W
Kamil W

Reputation: 2366

Jmeter - Execute sampler once per test

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:

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.

Upvotes: 1

Views: 2123

Answers (4)

Ori Marko
Ori Marko

Reputation: 58774

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

Upvotes: 1

Janp95
Janp95

Reputation: 584

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"

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168002

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

Scenario outline:

JMeter Switch Controller

Upvotes: 0

Ori Marko
Ori Marko

Reputation: 58774

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

Upvotes: 0

Related Questions