Randomised JMeter Test plan - jmeter

I'm trying to do a randomised interleaved. A cut down version is as follows.
If I have:-
Thread Group
HTTP - A
HTTP - B
Random Controller
HTTP - 1
HTTP - 2
HTTP - 3
HTTP - 4
HTTP - 5
HTTP - 6
HTTP - 7
HTTP - B
I get mostly what I'm after i.e.
A,B,[Random from 1-8],A,B,[Random from 1-8] etc..
The problem is that if I set to 8 runs I don't always get each of 1-8 being run.
What I'm after is a blend with what Random Order Controller does (run each child once) but only one.
The problem with
Thread Group
HTTP - A
HTTP - B
Random Order Controller
HTTP - 1
HTTP - 2
HTTP - 3
HTTP - 4
HTTP - 5
HTTP - 6
HTTP - 7
HTTP - B
Is that it does
A,B,[Randomly run each of 1-8 once] then ends.
e.g.
A,B,7,1,6,3,8,5,4,2 then ends.
What I need is the numeric requests are randomly selected but only run once each with A & B always run as interleaved requests.
e.g.
A,B,7,A,B,1,A,B,6,A,B,3,A,B,8,A,B,5,A,B,4,A,B,2
Thoughts?

Put everything under Interleave Controller and tick ignore sub-controller blocks box:
If you want to run the whole A->B->X sequence 8 times you will need to set the number of loops to 24 under the Thread Group
In general using random execution order is not the best idea as tests should (or even must) be repeatable so maybe it worth considering using Switch Controller instead?

Related

Run threads sequentially in multiple thread group and thread group in parallel - JMeter

I need to setup an test with respect to following scenario
Thread Group 1(Stepping thread group) (HTTP request 1 should continue for 5 min, THEN Http request 2 should be picked up for 5 min and finally for http request 3 - i.e 15 min test)
HTTP Request 1
HTTP Request 2
HTTP Request 3
Thread Group 2(Stepping thread group) (HTTP request 4 should continue for 5 min, THEN Http request 5 should be picked up for 5 min and finally for http request 6 - i.e 15 min test)
HTTP Request 4
HTTP Request 5
HTTP Request 6
Thread Group 3(Stepping thread group) (HTTP request 7 should continue for 5 min, THEN Http request 8 should be picked up for 5 min and finally stop - i.e 10 min test)
HTTP Request 7
HTTP Request 8
All of the above thread group should run in parallel as a test plan
How to achieve or setup the above scenario in a testplan
For running thread groups in parallel make sure that on Test Plan level
For running a Sampler for 5 minutes put it under the Runtime Controller
Another option is just moving the requests into separate Thread Groups, if you need to pass any data between them - go for Inter-Thread Communication Plugin

Jmeter - load testing multiple thread groups consecutively

I have 1 thread group with 4 HTTP requests, each using separate csv to get input(json).
I want to run load testing with 100 users for 10 loops for all of them.
Expected result: run HTTP request 1 for 100*10 times then move to HTTP request 2 and run 100*10 times and so on.
First HTTP request is provided with correct values and second with incorrect values, So first HTTP request gives 0% error and 2nd thread gives 100% error.
Issue: While running thread, 2nd HTTP request is also giving 0% error instead of 100% as it is somehow picking values from same csv as the first HTTP request(they both have separate CSV data set config with separate csv files having different data), while they are working fine individually.
My test plan
CSV Data Set configuration
In the same Thread Group all threads will be running simultaneously, there's no configuration option that would allow HTTP requests in the same thread group to run sequentially. So you can fix it in one of the following ways:
Put each HTTP request in its own Thread Group, and use Run Thread Groups Consecutively option
Thread Group 1
HTTP Request 1
Thread Group 2
HTTP Request 2
...
Use controllers and timers to get each HTTP request executed in loop and all threads to wait before starting the next one:
Thread Group
Loop Controller <-- set Loop Count to 10
HTTP Request 1
Synchronizing Timer <-- set Group by parameter to 100, so you wait for all threads to finish with first loop
Loop Controller
HTTP Request 2
Synchronizing Timer
...

Jmeter user session wise different data set

My test plan is as following
- Test Plan
- Thread Group (No of Threads: 4)
- HTTP Request Defaults
- HTTP Cookie Manager
- CSV Data Set Config(Login Information) [4 user login]
- Simple Controller
- HTTP Request(GET: Open Login Page)
- HTTP Request(POST: Login auth)
- Loop Controller
- CSV Data Set Config(Operation Information) [8 operation data]
- HTTP Request(GET: Open Operation page)
- HTTP Request(POST: Commit Operation)
- HTTP Request(POST: Logout)
In this plan suppose I provide 4 users and 8 operation data.
What it doing is running 8 operation for 4 users each in total of 8x4=32 operations.
How could I make this as following
1st user will do 2 operations
2nd user will do 2 operations
3rd user will do 2 operations
4th user will do 2 operations
I want to provide user session wise different operations that 4 users will do number of transactions but the transactions will not be same.
How can I achieve this?
If I'm getting your test scenario correctly you can just set the "Sharing Mode" of your CSV Data Set Config (Operation Information) to Current Thread Group.
Current thread group - each file is opened once for each thread group in which the element appears
If you want more precise control I believe Switch Controller is what you're looking for, using it you can select which user will go for which execution branch.
See Running JMeter Samplers with Defined Percentage Probability article for more information.
As requested, I am posting my solution. Below is the test plan story.
Test Plan
Thread Group
I used only 1 thread in my thread group and 4 in the loop count as shown below.
Loop Controller
CSV Config for the both the files
Output

JMeter - Access TransactionController in Beanshell Listener

I've created a BeanShell Listener element in my test plan which I use to collect SampleResult data for each HttpRequest and send to third party software. Presently there are four HttpRequests in my plan:
Get - Hit Login Page
Post - Submit data to Login Page
Get - Hit page to setup session
Get - Hit 'Home Page'
Steps 2 and 3 are related and ran sequentially so from a reporting perspective are essentially '1 step'. I've created a TransactionController around these two elements but my Listener script only appears to be able to retrieve the result data from the second of these two elements. Essentially I want my script to get the total time taken for these two steps for reporting.
Any thoughts?
I can't reproduce your scenario (using JMeter 2.8). Here is how my test plan looks like:
Thread Group
HTTP Request 1
Transaction Controller
HTTP Request 2
HTTP Request 3
HTTP Request 4
Beanshell Listener
My Beanshell Listener has row
log.info(sampleResult.toString() + " - " + sampleResult.getLatency());.
It logs (with omitted log info):
HTTP Request 1 - 143
HTTP Request 2 - 84
HTTP Request 3 - 83
Transaction Controller - 167
HTTP Request 4 - 93
Looks like it works

JMeter - Firing different requests in every iteration

I am currently using JMeter to simulate 5 users firing requests every 40 seconds. I have created 100 different requests but after every 40 seconds, each user is firing all 100 requests. I want to make it in such a way that after every 40 seconds, each user only fires 1 request and that request has to be different from the previous request. I would like to know what kind of controller to use (or anything else) to achieve this scenario.
Thanks
Try to use Random Controller.
The simplest way to implement your scenario:
Thread Group
Number of Threads = 5
Loop Count = N
. . .
Random Controller
HTTP Request 001
HTTP Request 002
HTTP Request 003
. . .
. . .
HTTP Request 100
Test Action
Target = Current Thread
Action = Pause
Duration = 40000
. . .
This will iterate 5 threads N times.
Random Controller will RANDOMLY pick up on each step http request from "requests pool" - all the samplers added as children to Random Controller.
Test Action will pause thread for 40 secs.
Updated:
working illustration for above scheme:
Thread Group
Number of Threads = 5
Ramp-Up Period = 0
Loop Count = 10
Constant Timer
Thread Delay (in ms) = 40000
You can download working example for described scheme from here: rc-plan.jmx.
This one works how you want (at least for me, Jmeter 2.5.1): it picks randomly ONE request from requests pool (in example - 10 requests) for EACH user (here - 5 users) on EACH step (here - 10 loops) and pauses each thread for 40 secs (Constant Timer).
You can also look into this mailing archive: Is their a way to randomize URL selection?.
Situation similar to your one seems to be described here.
...As per official documentation "Interactions between multiple controllers can yield complex behavior. This is particularly true of the Random Controller."
Another option for you may be to create a CSV file with parameters for your requests ahead of time and use CSV Data Set Config to parameterize a single http request.
That obviously depends on how different your http requests are, but if it fits your requirements there are some potential bonuses with maintaining 1 http request in your test plan vs. 100.
The other details would be the same as #Alies Belik laid out -- one thread group configured for your required number of threads and loops, with a constant timer at the end for your 40 second pause.

Resources