Not able to add data for 50 users using Jmeter - jmeter

Executed load testing script using JMeter for 50 users but it is not adding data in database for 50 users and adding only for 20 users, What is the issue?

Open your .jtl reusults file with a listener like Aggregate Report and check the number of failures, if it's around 40% - then you need to investigate the cause of the failures and see what needs to be done to fix them either from JMeter or from application under test perspectives.
If there are no failures in the .jtl file but your test is not doing what it is supposed to be doing - most probably it "silently" fails somewhere somehow. I would recommend adding Response Assertions to each and every step to validate that each response contains the anticipated data (or alternatively doesn't contain errors).
JMeter automatically treats HTTP status codes below 400 as successful and doesn't do any other checks so in case when an error occurs but application responds with a positive HTTP status code JMeter will consider the request as passed so you need to specify pass/fail criteria.
And last but not the least, you can temporarily amend the Results File Configuration so JMeter would store all the request/response details, after test run you will be able to examine the flows using View Results Tree listener and identify where and how exactly your script does fail.

Related

How to make several requests be made once? And the rest flow

I have 2 queries and a db connection that i would like to make once as part of testing
CSRF
DB CONNECT
LOGIN
And then comes the API method I need that I'm testing. Here it needs to be run a number of times.
I read the documentation, but I still don't understand. Please help.
Put them under the Once Only Controller, its children are being executed only during the 1st iteration of the Thread Group
I also see a number of Listeners in your Test Plan, when you finish test development and debugging don't forget to remove them as they don't add any value and only consume resources, you should execute your JMeter test plan in command-line non-GUI mode with all listeners disabled or deleted and once it's finished you can use Listeners to analyze the .jtl results file (or just generate HTML Reporting Dashboard from it)

JMeter - returns 401 unauthorized for few test

I am using jmeter to load test a website. I have tested from 1 to 400 users. however while testing for above 500 users/threads, I am getting 401/unauthorized error for few users. Hope you'll help me to find out a solution to this problem.
I can think of 3 possible reasons:
There is a parameterization problem with your test, i.e. it sends wrong credentials, you can use i.e. Simple Data Writer configured to save requests and response data for failing requests and inspect it using View Results Tree listener.
JMeter gets overloaded and cannot properly perform correlation. In addition to point 1 check whether you're following JMeter Best Practices and ensure that JMeter has enough headroom to operate in terms of CPU, RAM, etc. using i.e. JMeter PerfMon Plugin
Your application gets overloaded and cannot handle 500+ users, check your application logs, resources usage, output of APM tools, etc.

How to analyze errors in jmeter load test

I ran a sample test in Jmeter non-GUI mode and a transaction failed for few iterations. When I opened the the jtl report in View Results Tree listener, for the failed sampler I got 'No data to display' message. Not only this, but for all the samplers the same message was displayed.
Here I want to see what the request was and what was the response. How to get those details?
And also all the samplers are jumbled so it is very difficult to identify which iteration failed. Is there a way to get all the requests in an orderly manner?
Have a look at the listener Save Responses to a file you can save the failed responses to a folder and analyse that after your test. You can put variables (like ${__threadNum}) into the filename field to provide more information like iteration or user.

Invoke every HttpRequest after login in JMeter

Increasing User Threads in my JMeter performance testing, found some of the requests called before login. So those requests were failed.
My Test plan is below
In .csv file, added 1000 users with {email, password} and given to Login Http Request -> CSV Data Set Config. I'm extracting {uid} from login response and stored in uid
Second Random Controller, have multiple HttpRequest's, every request needs {uid}.
This works on below 50 user threads. But when i increased threads, some Random Controller ==> Http Request sends without uid
See, this one is with uid
But this one is with out uid
Can any one help me, how we can achieve this?
I can see 2 possible reasons:
Your application gets overloaded therefore your Login Request doesn't return correct uid so your extractors fail
Your JMeter intsance get overloaded so JMeter cannot handle 50+ users as you are running it in a non-optimal way
I would start with point 1 by temporarily enabling storing requests and responses data into .jtl results file by adding the next lines to user.properties file:
jmeter.save.saveservice.response_data=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.responseHeaders=true
This way you will be able to see response data for failed requests using View Results Tree listener and will be able to identify where the test fails.
Other things worth checking/implementing:
check your application logs
setup monitoring of baseline OS health metrics (CPU, RAM, Disk/Network IO) on both JMeter and application under test sides, you can use JMeter PerfMon Plugin for this
Make sure you're following JMeter Best Practices, i.e.
Run your test in command-line non-GUI mode
Increase JVM heap size
Switch to JSR223 Test elements instead of Beanshell

my jmeter script is running inspite of the application server being shut down

I created a jmeter script for an MSTR application. The server on which this application is hosted was shut down by the Development team but my script is still running successfully.
Why is the script not giving errors??
In case of HTTP Requests JMeter automatically treats all HTTP Status Codes which are less than 400 as successful.
You can consider adding i.e. Response Assertion to ensure that the test is doing what it needs to do and, expected information is present at the page, not expected information is not present, etc. You can also set maximum response time via Duration Assertion, check response for being HTML/XHTML/XML-compliant via HTML Assertion, etc.
See How to Use JMeter Assertions in Three Easy Steps guide for comprehensive information on conditionally failing JMeter samplers using assertions
You are getting an impression that the script is running successfully based on the response code you are receiving. For correctness of the tests, it is advised that you add response assertions to your scripts and add certain text as a pattern which is expected as result of successful response for respective request.
In this case you also need to make sure that you don't add response assertion for each and every request as it can make the JMeter script heavy to execute and JMeter may run out of memory if appropriate memory is not allocated.
Add a response assertion and re-run the test and make practice to use it to validate the correctness of your script.

Resources