So, I have 7 functionalities as below for simplicity.
Create customer - 10
Search customer - 100
Delete Customer - 10
Edit Customer - 30
Open Account - 10
Search Account - 100
Delete Account - 10
Now I want to simulate all of the above functionalities together in one test plan. For all functionalities, I need to login only once and then once all users for all functionalities are logged in, continue the respective activities for a period of 1 hour.
What I tried:
Place each functionality in separate thread group. For each thread group, keep login and logout separately and all other actions in a runtime controller having a runtime of 3600 mS. This serves the purpose but the timer of all users will be different (based on the time they login) which does not allow all users to start their period of 1 hour simultaneously.
Use ultimate thread group for each functionality and put login and logout in separate once only controller (login at start of thread group and logout at end) and other actions in loop controller with loop count checked as infinite. This works fine but it did not execute the log out once only controller at the end of the test.
The aim of doing this is to achieve the concurrency of desired users and also to run with achieved concurrency for desired duration of time.
Any suggestions on how can I go about with achieving this?
I would suggest the following approach:
Put your "login" logic into the setUp Thread Group
Put your "logout" logic into the tearDown Thread Group
Distribute the load across your "7 functionalities" either by putting them into different Thread Groups or via Throughput Controllers
You can pass the user identity (cookie, token, whatever) using one of the following options:
Inter-Thread Communication Plugin
__setProperty() function in the setUp Thread Group to write the identity into a JMeter Property and __P() function in other thread groups to read the values. Of course you should add __threadNum() function as the property name prefix/postfix to distinguish the identities for different users
Related
I'm relatively new to Jmeter but I have a scenario that I've not been able to figure out where I need to perform the following:
All user log in to application with a ramp-up period of 15 seconds between users.
No activity continues until all users log in to application.
Once all users are logged in, perform their set of business activities (will vary depending on business process, and based on iterations, not a time loop).
Once all users are complete business processes, users begin to logout with ramp-down time of 15 seconds between users.
Is this possible to configure my script to execute this way and if so, how? I have tried use of Once only controllers, loop controllers, constant timers, and some various plugins (Custom Thread Groups). I've also viewed various threads and not been able to find this exact scenario, but cannot imagine this is an overly unique test case...
Any recommendations or advice is appreciated.
Thanks!
This is highlighted in question above
Ramp-up period can be easily configured using "normal" Thread Group
To "wait" until all the users are logged in use Synchronizing Timer
Use Loop Controller to run the "business activities" as many times a you want
The same to wait until all the users finish executing their "business activities"
To implement ramp-down you can use JSR223 Timer and the following code:
return (ctx.getThreadNum() + 1) * 15000
where ctx stands for JMeterContext, see JavaDoc for all available functions and Top 8 JMeter Java Classes You Should Be Using with Groovy for more information on this and other JMeter API shorthands available for the JSR223 Test Elements.
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:
I have scenario where I want to run load test for 250 users.
Ramp up time is 10 mins for 250 users and run test for 50 min duration.
Question 1 : Is it recommended to do login and login out as part of set and tear down .. as the dev team does not measure login and log out .?
Question 2 : How do i keep the the other thread group in loops during the 50 min duration . ?
I wouldn't go for it as normally different thread groups should represent the different groups of virtual users, setUp thread group is for accomplishing the pre-conditions for the test and tearDown thread group is for cleaning everything up. If you perform the login in the setup thread group - there will be negative consequences like having to pass login context (tokens, headers, cache, etc.) to other thread groups. So I would rather move login to be the integral part of the main thread group and if needed remove login/logout via Filter Results Tool (not part of vanilla JMeter, can be installed using JMeter Plugins Manager)
It can be done on either on Thread Group level like this:
or you can "loop" the arbitrary part of the test by putting it under the Runtime Controller:
I am doing load testing for one ecommerce website. I am using Ultimate thread group.
Now I want to send per user only 1 request. So for ex: If 500 users then only 500 request should send. How can I achieve it using Ultimate thread group?
Why I want above because I am doing whole process like login, select product, add to cart and checkout. So it should do everything only once per user.
Your test design is a little bit flaky as given each user does login, select product, add to cart and checkout you will have at least 4 requests per user which gives 2000 requests in total (doesn't include embedded resources calls). You can use Transaction Controller to group these requests into one "workflow" however it won't limit actual amount of requests.
If you need to run your workflow by each user only once you may run into a situation when either load will be less than 500 concurrent users or test duration will be less than 30/60 minutes, see JMeter Test Results: Why the Actual Users Number is Lower than Expected
If you add more iterations each user will be executing your workflow more than once
Normally web test plan should look as follows:
Given each user executes test scenario steps and acting like a real user
Gradually increase the number of users unless application response time becomes too high or errors start occurring, whatever comes the first
Analyze results, identify the bottleneck, report your findings
Lets say the duration of the test is 1 hour. First user completes the workflow you had mentioned in the first 10 mins itself. What should happen after the workflow for the user? Should the thread be idle for the remaining 50 mins?
I think you should use the regular Thread Group with 500 threads and loop count as 1. Ultimate Thread Group is for duration based tests. You could use Once Only Controller as a workaround inside to do the action only once for the user. But it is an ugly approach.
You can use Throughput Controller.
The Throughput Controller allows the user to control how often it is executed. There are two modes:
percent execution
total executions
Percent executions
causes the controller to execute a certain percentage of the iterations through the test plan.
Total executions
causes the controller to stop executing after a certain number of executions have occurred.
Like the Once Only Controller, this setting is reset when a parent Loop Controller restarts.
I want to test multiple scenarios in a same website using JMeter.
For example I have 2 thread users.
I want..
>1st user performing 1st scenario: like login his account
>2nd user performing 2nd scenario: browse some other page
How this can be achieved in JMeter?
If you need 50% of users to perform login and 50% of users to browse the website there are following options available:
Use 2 separate Thread Groups:
Thread Group 1: with virtual users who perform login
Thread Group 2: with virtual users who perform browsing
Use Throughput Controller like:
Add Throughput Controller configured like:
Percent Executions
50.0
Add the relevant sampler(s) under the Throughput Controller (as child)
Do the same for 2nd, etc. scenarios
See Running JMeter Samplers with Defined Percentage Probability article for more detailed explanation of above and more complex distribution scenarios.