jmeter - I would like to know if it's possible to have login as part of the set up and logout as part of tear down for 250 concurrent users - jmeter

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:

Related

Jmeter Scenario: Users Login once - pause until all logged in and execute process (based on iterations not time) - processes complete users log out

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.

Simulate Loadrunner like jmeter scenario with multiple functionalities (thread groups)

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

Performing many tests in 1 test plan

I need to perform tests on hundreds of HTTP links one after the other.
That means i want to, for instance, perform a 3 minute test with 5 users on 1 link and after that's done, do the same for the next link.
1 way to do this is to create a ThreadGroups for each link, each having a HTTPsampler and just have all of the run consecutively. But i read that that would create memory problems for the testing machine.
So what is the correct way of doing this? I really don't feel like creating and manualy running a separate TestPlan for every link.
You can use only one HTTP Request sampler, the suggested Test Plan structure:
Thread Group with the number of threads (virtual users) you want to simulate
CSV Data Set Config containing the list of URLs
Runtime Controller configured to last 180 seconds
HTTP Request sampler configured to hit the URL:
This way you will hit 1st URL for 180 seconds then 2nd URL for 180 seconds, etc.
For the problem you have mentioned you can create single test plan instead of multiple test plans and add multiple thread groups inside it and make sure that run thread consecutively is checked.
In each thread group mention the thread count and test duration as mentioned in the example below.

How to control no. of requests per user in Jmeter

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.

Simultaneous users for web load tests in JMeter?

I have made some PHP scripts and I want to test the response time for simultaneous users in JMeter. This scripts are run in a very short time (50 miliseconds).
What I would like to do is to simulate a load test from 1 to 50 of users where each user (thread) repeats the request for an unlimited period. So first we will have 1 user, after 2 simultaneous users, after 3 ... and so on.
I am trying to do it but with I have is response times where it is evident that there is no simultaneous request.
With HP loaddrunner we can define number of iterations for each thread, is this possible in JMeter?
You can possibly use these 2 thread group implementations
Stepping Thread Group
Ultimate Thread Group
from Jmeter Plugins package, that let you set load-increase for you scenario as you want.
As well you can also look onto Synchronizing Timer if you want "better" concurrency - but this is rather stress-testcase than load one.

Resources