Currently I am setting up performance tests with visual studio. I have a data set containing 30 rows.
My test scenario is intended to be as follows:
User logs in
Visits 30 URLs defined in my data set
User logs out
With the default functionality, the scenario does:
User logs in
Visits URL 1 defined in my data set
User logs out
User logs in
Visits URL 2 defined in my data set
User logs out etc.
This happens 30 times in total.
Is there a way to only repeat the step where the data rows are referred to?
Thanks!
There are at least two approaches.
First approach. Have three tests. One for logging in and a second for logging out. The third test has the main activity which is to visit one URL and it will be data driven. In the load test specify the load test mix to have the login and logout tests as the initialisation and termination tests, the main test will be added to the test mix. Set the "percentage of new users" in the scenario properties to be 0%.
Second approach. Have just one test with the login and logout at the start and finish of this test. Between them have a loop that visits the URLs specified in the data source. Set the "advance data cursors" property of the loop to true.
Related
I recorded .jmx script by recording Blazemeter tool.
I followed below steps:
Login into application.
By default user landed on page which is Search Page where Patient list is displayed.
Now I select Patient and Navigate to Flowsheet page by clicking on HD Flowsheet menu button. Patient selection is mandatory.
Saved Flowsheet.
Logged Out.
Thread Group Detail:
Action to be taken after a Sample error: Continue
Number of Threads(users): 10
Ramp-up period (seconds): 100
Loop Count: 1
Same User on each Iteration : Yes
After executing script with above Thread group, In database only 6 Flowsheet is getting inserted instead of 10 flowsheet.
I checked View Result Tree, It is showing no error and also in Summary report it is showing 0% error.
What can be root cause? What strategy I should follow in such cases to debug script?
JMeter automatically treats HTTP response status codes below 400 as successful, it won't do any extra checks for the "flowshit" creation or insertion simply because it doesn't know anything about it.
My expectation is that your test silently fails somewhere, add View Results Tree listener and inspect response details for each step, most probably you will see that either you're submitting the same flowsheet over and over again or your script got stuck somewhere.
If you want to add an extra layer of verification, i.e. ensure that response contains specific value, you can add a Response Assertion to each request and specify pass/fail criteria there
In general when it comes to modern web applications the chance you will be able to successfully replay recorded script is close to zero because there are multiple dynamic parameters involved like ID of the patient or flowsheet, cookies, tokens, etc. and these dynamic values need to be correlated
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.
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.
In this case, I have created several webtest scripts, and added them to a load test (distributed by expected use).
What I would like to do is send a user load (500 for example) where all users run at the same time, each user is given only a single script to run and complete, then the test is finished. One iteration for each user.
I am finding that iterations are not user based but test based, so only one user and test is completed when selecting a Test Iterations value of 1 for 500 users.
Is there a user based iteration setting or some other way to accomplish my intended test?
Thanks.
The test settings you have used are not at all clear from your question. However assuming you want to start 500 test cases at the same time and stop after they have completed then you can use the following.
In the properties of the scenario: Set the user load to constant and to 500 users. Also set maximum test iteration to 0 (meaning no maximum). I would also set the think time between iteration to much longer than you expect the test run to take; this setting may not be needed but it avoids unexpected behaviours.
In the properties of the run settings there are two possibilities.
Either (1) set the test iterations to 500.
Or (2) set the run duration to long enough for all 500 tests to complete, but shorter than the think time between iteration in the scenario.
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: