I am new to jmeter, so please bare with me if I have asked a silly question. I have a thread where I want to run that thread like 100 times. In the thread I have scripts like
Add a member to a mailbox,
Get the mailbox details and confirm the member added was displayed
update the member role in that mailbox
Delete the member from that mailbox
I am using same mailbox and user for my test for my loop. Here the issue is the same member cannot be added to the same mailbox unless we delete that member from that mailbox.
So when I run the test with just 5 iterations, the add script for first iteration was passed and next 4 iterations for that add script getting failed. Because the first thread already added the user to that mailbox and while the second user tries to add the same user it fails, that's expected.
Steps I tried:
I even tried using constant timer in my add script to wait for 4secs so my previous user actions should be done. That's my understanding. Please correct me if that's wrong.
The other thing I tried was ramp-up time to 8 secs and then the script for 5 users ran fine. But when I increase the users to 50 then almost 50% of the scripts failed.
Here comes my problem. How do I make the second user to wait until the first user done with the delete script, so second user can use the same data and so on.
Attached are some screens of my scripts
Please let me know if you need any other information.
Thanks
Each JMeter thread (virtual user) should represent a real user with its own credentials and mailbox. Credentials and/or mailbox can be parameterized, normally people use CSV Data Set Config to provide test data for JMeter scripts
If you have only one user/mailbox - you won't be able to use more than 1 thread (virtual user) in the Thread Group, to wit if you need to run the scenario 100 times - you need to set it up like:
Another option is using Critical Section Controller. But be aware that there will be no concurrency (only 1 user will be running the test at a time), if you need to have more - you will need to use different credentials for different users
Related
I am trying to perform load testing on NodeJS application, the application allows single login session for an user.
But, when i tried to perform load testing with 8 concurrent users (using the same credentials) it was working.
So, i tried to create 10 user IDs and added to the CSV file and configured "CSV Data Set Config" and "HTTP Cookie Manager" and set the "Number of Threads" to 80.
When I run the test plan, the credentials are not passed to each sessions equally. for example, userID1 is passed 3 times and userID2 is passed 7 times.
Can you clarify the reason for this behaviour and how to run the threads with each credentials (8 sessions for every credentials) from csv file ?
Make sure you have set the options for CSV Data Set Config as All Threads for Sharing mode and provide a minimum ramp-up period (say 1 second) so that each thread reads the CSV lines properly without clashes.
For the question why it worked 8 concurrent sessions , where you allow only single session from UI - My guess is you used the same credentials for all 8 users - so server might have considered it to be 8 parallel requests from the same user. It depends on how session is maintained. For eg., if it was with a session-cookie , then If you had 8 different cookies it might have failed. But this is only a guess, as I don't know how its done in your app.
JMeter acts as follows:
All threads are started within the bounds of the ramp-up period which you define in the Thread Group
Each thread starts executing Samplers upside down (or according to the Logic Controllers) as fast as it can
JMeter waits for previous request to finish before starting next Sampler
When the thread doesn't have any more Samplers to execute and loops to iterate - it's being shut down
If you observe the situation when this or that logic was used more than another, most probably the response time for the login was less.
You might want to check the size of the response as for successful requests it should be more or less the same and it might be the situation when the server returns HTTP Status code 200 but response body contains errors, to wit some logins may fail silently, if this is the case it makes sense to add a Response Assertion to add some extra checks, i.e. presence of "Welcome" text or "Logout" link or absence of "error" text or whatever.
What i could understand is you are trying to achieve 8 session each user.in order to do that you have to make 10 concurrent threads and 8 iterations that is how you will achieve 8 session for every credentials.
But of your requirement is to run 80 concurrent users then try to make 80 users and run the test.
Good day, guys!
What I attempting to do is perform a clean logout for all users after test stops running via duration restriction.
In my case, when user logs in, he gets unique session id parameter that makes it impossible to log with same user from different tab/browser/place, so I need to be sure that user is not blocked after my test completes.
Lets say I use 100 users for a test.
My test looks something like:
Login (get session id)
do stuff
do stuff
Logout (terminate session)
It works fine when I use a constant set of loops, but when I run test with duration, for example, 600 seconds, test stops in the middle after time runs out and my users are blocked until their sessions expire by timeout.
I tried to create a second thread which also contains 100 users and only a logout HTTP sampler, passed and used session id variable to it as described in article https://www.blazemeter.com/blog/knit-one-pearl-two-how-use-variables-different-thread-groups but it seems that my second thread receives only a last session id value so it basically logs out 1 user 100 times, but I need to log out 100 users 1 time.
Does anyone now how to store multiple values of a variable and use them in correct order in other threads?
Not a programmer, just a manual tester with some extra responsibilities.
Thank you.
JMeter Variables are local to each thread, JMeter Properties are global for the whole JVM so if you're passing variables between thread groups make sure you add current thread number as a prefix (or postfix) for the generated property, something like:
In the first Thread Group define user-specific property using __setProperty() and __threadNum() functions combination:
${__setProperty(foo_${__threadNum},${YOUR_VARIABLE_HERE})}
In the second Thread Group get user-specific property using __P() and __threadNum() functions combination:
${__P(foo_${__threadNum},)}
Replace foo with the property name of your choice
Replace YOUR_VARIABLE_HERE with the name of the relevant JMeter Variable
Demo:
See Apache JMeter Functions - An Introduction to get familiarized with JMeter Functions concept.
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 have to simulate multiple user logging in and going through a sequence of web services in JMeter. The web services are-
1.login
2.startjob
3.endjob
4.logout
I have 10 users and all of them will simultaneously login and run through the steps 1-4.
The steps are-
User will login using "login" service. They will get a session token (ST) in the response.
Using the ST from above step the user will start the job using "startjob" service
After the job is finished, "endjob" service is used.
Finally user is logged out using "logout" service.
So far I have been able to do the above steps properly for one user.
I have created a CSV file with 10 usernames and passwords and am able to make only the "login" service iterate through all users using CSV Data Set Config.
How do I make each individual user go through steps 1-4?
In JMeter, each individual Thread or User will execute every sample within it in upside-down order. So for a single user, when we run the test, the result will appear in that order. But Ramp up time is related to Thread creation:
How long JMeter should take to get all the threads started is the
Ramp up time.
Within this time, all the users will be initiated and all those Threads will execute the samples underlying it in the same fashion as it does for a single user.So in you case, all the 10 thread will go through steps 1-4, but the threads will initiate within your ramp up time.
If you observe the output in View Results in Table listener and trace the Start Time of the samples for a corresponding Thread, you will see that those samples are executed through the steps of 1-4.
For an example, I have 4 samples under my Thread Group and I have defined Threads or Users : 3 and Ramp up : 5. All those three Threads executed the samples Through 1 to 4.
Image here:
I have created a test plan with multiple thread groups that I want to execute simultaneously.
One group (A) involves tagging a folder with 1000 images in it, so it takes approx 10 seconds to respond.
The other group (B) is real quick.
What I've found is that group B seems to "stick" and wait for thread A to complete. Now all the reading I've done says that thread groups should be totally independant, but this doesn't seem to be the case in my test plan.
I have an HTTP defaults manager, cookie manager and user defined variables that are shared between groups (but have tried adding them in the separate thread groups).
Anyone got any idea why this should be?
Script is here: https://www.dropbox.com/sh/fhdof4ynjt73s2p/mkrphWcfHK
(likely will not run or stick though as this uses internal URL's)
This issue is not in JMeter, it is the application that is locking.
Looking at your test, you seem to use one user to do your load test, this clearly explains your issue and makes your test unrealistic as you have around 20 Users logged with the same user/password.