Test concurrent users with different browsing patterns - performance

So using Jmeter today and whilst I know i can load test a website with concurrent users using threads, loops etc I was wondering if it is possible to setup a test where say 50 users access the website and then each of them browse the site in a different way?
Has anyone done this before or would jmeter not be the tool to use?
Looking for some suggestions or an idea how to do it in Jmeter.

Suppose you have at least the following simple possibility:Random Order Controller.
Implement set of navigation/browsing steps via separate samplers or group of samplers (grouped via e.g. Simple Controller or Transaction Controller - if some steps should be always executed in defined sequence).
This will be "pool" of navigation steps.
Adding all these steps as child samplers to the Random Order Controller let you have different, per user, randomly generated sequence of navigation steps.
In this case you possible have to put your login/logout samplers (if any) out from Random Order Controller. As well you can e.g. use both scenarios with and without login/logout, etc.
Thread Group
...
Login Sampler
Random Order Controller
Sampler A
Sampler B
...
Sampler X
Logout Sampler
...
As well you can also additionally look onto
Random Controller
Switch Controller: e.g. define in csv-file per-user navigation scenarios, read these scenarios during script execution and assign extracted actions to each thread;
Include Controller.

Related

JMeter how to load certain group of users

I am loading a csv file with usernames and passwords of users.
Each user belongs to a certain group eg. Group1_user1, Group1_user2,.... Group7_user1, Group7_user2 etc.
I have recorded with my Script Recorder in JMeter the HTTP requests for log in of all the users and then the steps of a HTML stepper process.
Only one group has the permission to complete a step.. there is an hierachy in the groups.
So, my question is.. since I am loading all the users, how am I going to test each step for the users who belong only to the right group?
I cant use plug-in and I cant break my Test Plan into smaller Test Plans.
Normally you should be using different Thread Groups for representing different groups of logical users, so I would suggest moving at least those guys who have permission to complete a step into a separate thread group.
You can implement synchronization and passing data between thread groups if needed using Inter-Thread Communication Plugin
If you have to stay with the single Thread Group you can use If Controller or Switch Controller to conditionally decide which step can be taken by which user.
For example if you use the following __jexl3() function as the If Controller's condition:
${__jexl3("${username}".contains("Group1"),)}
then If Controllers child(ren) will be executed only if ${username} variable will contain Group1
Demo:

Running Jmeter Test in multiple accounts parallelly

I have set of sampler under one Thread Group as
TestPlan
ThreadGroup
SimpleController
Login(HTTP Sampler)
FetchCSRFToken(HTTP Sampler)
LoopController(Count -> 5)
Testcase1(HTTP Sampler)
Testcase2(HTTP Sampler)
Testcase3(HTTP Sampler)
Now I got a requirement to run the above test cases in multiple accounts parallelly.
I googled and find out having Multiple Thread Group is a better idea since I suppose to run it parallelly and I have to pass CSRF token in all test cases header.
Is it possible to have two thread groups without duplicating the test cases inside Loop Controller of Thread Group-1 to Thread Group-2?
Kindly suggest if any other way as well.
If you want to avoid code duplication - just put the "shared" code under a Test Fragment and reference it using Module Controller(s) where required
In general a Thread Group should represent a logical/business group of users, if you just need to add more users doing the same actions - you can parameterize credentials, URLs, parameters, etc. so each thread will use different set of data on each iteration, the most commonly used approach for parameterization is CSV Data Set Config

Execute requests from the scenario in random order [Taurus/JMeter]

I have a pretty big load test scenario for execution that I want to run with Taurus. It has more than 1000 different requests - some of them in loops because I would like them to execute several times.
Now that I have the scenario completed I'm looking for a way to randomise the requests during the execution. For example instead of the Taurus running the tests line by line from the scenario I would like Taurus to execute requests from the scenario in random order.
Any ideas how this can be achieved?
You can add to JMeter test plan Random Controller
Random Logic Controller acts similarly to the Interleave Controller, except that instead of going in order through its sub-controllers and samplers, it picks one at random at each pass.
You can even set 1 request at a time
ignore sub-controller blocks If checked, the interleave controller will treat sub-controllers like single request elements and only allow one request per controller at a time.

Randomize path in JMeter REST API load testing

So I have a REST API that I want to test with JMeter.
I have few different paths in the REST Service.
If we take an example of simple REST service that will calculate based on two values passed in request, I have four different paths
/add
/sub
/mul
/div
Now I want to test this with a 5000 requests but want to randomize the path and the values in request parameters in each request. Also if possible, want to get the results in 4 categories separately for each path.
Can someone please suggest the right combination of elements?
I am very new to JMeter and hence, expect a little elaborated answer. :)
The fastest and the easiest way is using __chooseRandom() function available via JMeter Plugins. The relevant configuration of the HTTP Request Sampler would be:
Path: /${__chooseRandom(add,sub,mul,div,path)} - get a random option and store it into ${path} JMeter Variable
Name: ${path} - change HTTP Request Sampler Label (for separate reporting)
You can install __chooseRandom() and other plugins Functions via JMeter Plugins Manager from the "Available Plugins" tab:
Be aware that your requests will be random hence your test scenario won't be repeatable so I would recommend considering using other test elements instead i.e. Throughput Controller or Switch Controller or Weighted Switch Controller.
See Running JMeter Samplers with Defined Percentage Probability article for above test elements configuration details.

How can i execute several scenarios simultaneously without using several thread groups

I have created seven thread groups which execute different scenarios in one application. I'm trying to optimize my scripts in order to be more maintainable and easy to master when someone else uses them.
The thing that i cannot figure out is how can i combine those thread groups into one or two and to still have the seven different execution paths and the possibility to control them, by control i mean to set how many users to execute scenario 1, how many to execute scenario 2 etc. till 7.
Currently the test plan looks like this
If you don't want several thread groups for some reason the alternative options are in:
Throughput Controller - with different global executions or execution percentages
Switch Controller - which provides random weighted values (in some cases Throughput Controller doesn't guarantee that samplers in scope will ever be executed)
See Running JMeter Samplers with Defined Percentage Probability guide for more information on configuration and implementation.
Well i just figured out how to do that i have added a Loop controller a Random Order Controller as child of the loop controller. And i have put seven throughput controllers as child of the Random Order Controller so now everything looks fine

Resources