How to open a new incognito browser instance using JMeter - jmeter

As I need to perform load testing on large number of users say 500 or 1000 so how do I run the login scenario with just 1 user login credential. As I understand if just 1 user login credential is used then only the 1st thread will be ritually logged in the other threads would actually bypass the login process and land on to the home page.
One of the solutions is to create as many users as required which is a time taking activity.
I was just wondering if there is a way to create a new incognito browser instance on JMeter for each thread such that each thread logs in by entering the credentials each time. Note that in this case we still have 1 user login credential but as we are creating new incognito instance so the application asks for the login credential each time.

As I understand if just 1 user login credential is used then only the 1st thread will be ritually logged in the other threads would actually bypass the login process and land on to the home page
your understanding is not correct, JMeter Threads are absolutely independent and authentication context is not passed between them so each JMeter thread will get the login page and will have to authenticate no matter of what others are doing.
It is possible to pass the authentication context to other threads using i.e. Inter-Thread Communication Plugin but by default you don't need to do anything, each thread is "incognito" as all the variables, cookies, cache, etc. are local to each particular JMeter thread (virtual user)

Related

Jmeter- I have scenario where Users login once and does various transactions multiple times in a thread

Jmeter -->I need to do load test a scenario with 10 different users should login only once and other transactions should be done for multiple times ( might be using Thread) . And the 10 Authorization of all users should be used in other transactions.
I tried "IF controller" with code "${__groovy(ctx.getThreadNum() == 0 && vars.getIteration() == 1,)}" but authorization is used only once in other transactions
Once only controller also used -- Not working .. I think i am missing some logic here.
JmeterScreenshot_Scenario
Given your current implementation only 1st user will be logged in, others will skip the login request
Given you have 200 threads (virtual users) each of them needs to be logged in, authentication context is local to the thread (virtual user)
So if you plan to authenticate only 10 users, remaining 190 will not be authenticated hence all Transaction Controller children will be failing.
A good solution would be requesting more credentials so each of 200 users could have it's own username/password combination.
If a single user can be logged in only once and it's not possible to have more credentials, as a workaround you can authenticate 10 users somewhere in the setUp Thread Group and then pass the authentication context (cookies, tokens, whatever) to the main Thread Group via __setProperty() function or Inter-Thread Communication Plugin

How can i simulate just one login for all thread groups?

I have just started working with Jmeter (5.1.1) and i have multiple thread groups.
In every thread group, i have to add the login http request or else the tests will fail.
How can i simulate just one login request for all the thread groups ?
Thanks in advance.
You can add a setUp Thread Group in order to execute the login, setUp Thread Group should be used for preparing test data, if you really want to use the same context coming from a single login from all virtual users in all thread groups (this makes sense only if you're using JMeter for a functional test) you can perform the login only once there.
Once you perform the successful login you should pass the associated indicator of the login (most probably it will be Cookies or other HTTP Headers) to other Thread Groups, the value(s) can be set using __setProperty() function in the setUp Thread Group and read using __P() function in other Thread Groups

How to do load testing?

I have been working on performance testing for a while. I want to ask if there is any difference between running the test for 500 virtual users using the same username and password or should we be using different user for each virtual user.
If the test was executed with the same user, will the user data be cached on client or server sides and the results won't be accurate?
Thanks!
It is all about How realistic is your test scripts.If 500 virtual users login with different credentials of username and password, then it will mimic the real life scenario.Login with same credentials will not.
You should use "HTTP Cookie Manager" and "HTTP Cache Manager" in your Test Plan.Using "HTTP Cookie Manager" enabling "Clear cookie each iteration" and "HTTP Cache Manager" enabling "Clear cache each iteration" will at least bring some luck for 500 VUsers using same ID and Password. In this case, every user will be assigned with different session ID and the session cookie and cache will be cleared before next login using "Same Username & Password".So though ID and Password are the same but previous cookie and cache are cleared before new login. So the result will be more accurate and realistic.It basically depends on your test script design.
Though it is always appreciated and recommended to use different credentials despite using "HTTP Cookie Manager" and "HTTP Cache Manager" in your Test Plan.
IMHO, the load testing should simulate as closely as possible the real user behaviour, BUT the final answer is really dependent on your application, on the budget you have to do the test, and on the perception you have about how critical is scanning the user DB.
In one case, I had to create a number of user which was 10x the maximum number of virtual user I actually used in each test.
I think that simulating users connecting with the same account will most likely always hit the cache or the same components.
For example a cart on a web store: if you rely on the same user account, you will have concurrency issues when adding products to the cart. More information in this blog post: What makes a realistic load test?

Can login page can be tested in Jmeter

Can login page (where we need to enter the credentials) be tested?
And URL of that website after login page can be tested without login?
JMeter is able to simulate login event and represent authenticated user. See i.e. ASP.NET Login Testing with JMeter guide for example configuration and associated correlations.
If you need to simulate N authenticated users and X unauthenticated ones you could use Throughput Controller for scenario distribution.
Answer is Yes and To a Large extent Yes.
Yes, Because it can be done for Web Page Logins and as Dmitiri said ASP.Net logins also.
Why i am Saying "to a Large Extent" is NTLM and Kerberos Authentication for Logins can be a bit troublesome. Where you need to be sure about the Domain names, the exact details.
Now, it depends where you are being asked for the User's Credentials . Normally for a Simple Web Page login - You Would get the URL from the address bar and you need to pass that.
For NTLM and Kerberos ones, you need to do some research so as to where you are getting authenticated and grab hold of that page.
We did for NTLM one and the login and authentication pages were different.

Jmeter-simulate 150 logged in users on the website and make request to other page with logged in status

I have a scenario where I have to simulate 150 logged in users on the system and they will be making request to a different page at the rate of 8 requests per second with login status.
How do I do this
Assumption 1: Thinking of having two http samplers one for login functionality and other one for requesting the page I wanted (Select product page). But my doubt is, is this the right way to simulate the logged in user on the other page(select product page)? as login and select-product page requests are in different HTTP samplers, their access rights will be treated differently I guess and I will be ending up as an anonymous user on the
select-product page instead of logged in user. Please suggest a solution.
I don't want to login each time I make a request to select-product page as the login is big bottle neck which takes lot of time, rather I would like to log all users at first than use the logged in users to ping select-product page with logged in status.
If I have multiple HTTP samplers (for login, select-product), number of request to server are increasing, but at all times I want to limit number of requests to 8 only.
Please help.
thanks.
Check links and tips below for solutions:
If you put your Login and Select Product samplers under the same Thread Group - login and select product actions will be executed by the same thread.
Add HTTP Cookie Manager to your test plan. It'll keep session information so the same (and unique for each thread) session will be used per thread.
To perform login only 1 time place the relevant sampler under Once Only Controller
To limit load to 8 requests/sec only use Constant Throughput Timer.
Hope this helps.

Resources