Jmeter- Unable to understand result for the workflow - jmeter

My website workflow is as follows:
User Name-->Password-->Click on login button-->Click on Report menu(Daily Transaction)--->Select date and device in report-->Click on Generate button.
Now I want to check load testing for this scenario that if multiple users gets logged in and access the reports, how my website will act?
I have created csv file for multiple user login with report data. But not able to understand the output coming. It is displaying Login request twice i.e. Login request and under daily report request it is again displaying login request. I have created Login request and report request separately.
In result I am not getting why it is displaying login request again under daily report request.

I believe that it is due to 1st login request failure as daily report request is not available for non-authenticated user. I would recommend taking the following steps to resolve your issue:
Add a HTTP Cookie Manager to your Test Plan. It will automatically care about handling cookies and hopefully will be enough to let you to proceed.
If not - record your login request several times and inspect recorded requests to see if there are any differences. If they are - you'll need to provide some mandatory dynamic parameter along with credentials. In that case test Scenario skeleton will look as follows:
GET request to Login Page
Extract dynamic parameter value
POST request to Login Page providing username, password and dynamic parameter name/value pair
See ASP.NET Login Testing with JMeter guide for more details on dynamic parameters extraction and usage bits, even if your application is not ASP.NET based it should still give you a clue on what needs to be done.

If you are using Transaction Controllers this can yield misleading results like you are seeing.
For example, take the following:
Transaction Controller - Name "Login"
HTTP Sample - Name "Login"
If "Generate Parent Sample" is selected on the transaction controller, you will only see the Transaction Controller in your results. If this option is not selected, you will see both the HTTP Sample AND the Transaction Controller in the result set.
Also, please note that the "Parent Sample" time is recorded as the TOTAL time taken to do all requests in the transaction end to end!! In almost all cases this reports inaccurate times because a real web environment has asynchronous calls.
For this reason it is strongly encouraged to avoid transaction controllers. In one case you report end-to-end time for all samples which is incorrect, and the other alternative is to report the transaction controller AND the sub-samples, which in turn makes your test report the incorrect rate of transactions.

Related

Jmeter login script

I am using Jmeter for testng load balance of website.I written a script to test the scenario like to make the user to login into the website and able navigate the user to the dashboard where he can see the recent data by consuming the protected calls.Here i am able to pass the user login scenario but the jmeter showing fail errors regarding the protected calls.When i am searching the url thing whcih is given by jmeter i able to understand that teh protected calls need user credentials to consume data but it fails due to absence of user login things.
Here i am able to pass the user login scenario
are you sure? If JMeter reports the HTTP Request sampler as successful it doesn't necessarily mean that the login will be successful, it might be the case your application responds with status code 200 and some error message explaining why the login has failed and JMeter automatically treats HTTP Status Codes below 400 as successful.
Try inspecting request and response details using View Results Tree listener which has HTML and Browser modes and double check that you're able to login.
If yes - you might need to add HTTP Cookie Manager or perform the correlation of the authorization header in the HTTP Header Manager for the "protected calls" or something like this
If no - you will need to amend your script so login will be successful. In order to avoid such situations in future you might want to add Assertions to your test plan to ensure that JMeter is doing what it's supposed to be doing

How to click a button on pop uo URL in jmeter without recording the script so that a data can be saved in the application

i have a web application which has confirmation pop up to save a record . i have used post on the HTTP request sampler and used parameter body , but still the record is not getting saved in the web application using jmeter . i have to click save then yes on the confirmation pop up
JMeter doesn't actually perform "clicks", it sends HTTP Requests, in your case this "popup" seems to be used for populating the USER_COMMENT section:
with regards to "record is not getting saved in the web application" - it indicates that your script fails somewhere somehow, you should inspect response details using View Results Tree listener, it might be the case the application will tell you what's wrong with your request.
The most common reasons are:
Your login request fails hence all subsequent requests are landing at the login page. JMeter automatically treats HTTP status codes below 400 as successful therefore you can see them as "green" or false-positive so check that all previous responses return expected data using the aforementioned View Results Tree listener
The request may fail due to missing or improperly implemented correlation, i.e. you're updating the record which was created during recording instead of adding a new one

JMeter web page test - Your session expired because of inactivity

There will be two actions once we click on log in button
login page action
dashboard action
Part of JMeter
login page action got success.in the continuation
dash board action got failed saying
"text":"Your session expired.","explanation":"Your session expired because of inactivity."
Can anyone help me please..
Your SUT is likely to have some form of verification mechanism which checks user session by verifying parameter(s).
Well-behaved test should do exactly what real browser does, to wit:
Open login page
Perform login
Open dashboard
and your job is to ensure that requests which are being triggered by JMeter are 100% match to the requests which are being sent by the real browser.
Try adding HTTP Cookie Manager to your Test Plan, if your SUT checks the cookie - that should be enough. If not - most probably you will need to perform correlation - the process of extracting dynamic parameters from previous response using JMeter Post-Processors, saving them into JMeter Variables and replacing hard-coded (recorded) values with these variables.

E commerce load test with complete flow

I'm trying to do a load test of e commerce site with complete flow from product search, login to add to cart and submit. Product search and anonymous order is working fine but when I'm trying to run script for registered user it's not working. How can I fix this?Click here to download script
Your "download" link is broken or expired or whatever.
Most probably your request doesn't work for authorised users due to missing or improperly working correlation. Modern web applications cannot be just recorded and replayed as they widely use dynamic request parameters mostly for security reasons. So if this is the case your test needs to look as follows:
Open Login Page (usually GET request)
Extract dynamic parameters using one of matching JMeter Post-Processors and store them into JMeter Variables
Perform Login (usually POST Request) providing not only credentials, but also dynamic parameters values from the first request
Also make sure you add HTTP Cookie Manager to your Test Plan - it represents browser cookies and automatically deals with cookie-based authentication
You might want to try an alternative way of recording a JMeter test - using cloud-based proxy which is capable of exporting recorded tests in "SmartJMX" mode with automatic correlation of any dynamic parameters detected. Check out How to Cut Your JMeter Scripting Time by 80% article for more information.

Does Jmeter saves the randomly generated email id (pre-processor-user parameters) in the database

I have used Jmeter's pre-processor 'user parameters'to generate random email ids to test singup api, able to susscefully generate and signin. However not able to see the randomly generated email id in the database (using mongoDB), it is not stored in the DB.
Does jmeter saves the email id in the DB?
By default JMeter doesn't store anything into the database. If your API sign-up process assumes storing email of the signing-up person to the database - something is wrong with your test scenario.
JMeter automatically considers HTTP Status Codes below 400 as successful, it doesn't do any checks of the response body so my expectation is that you are receiving pseudo-successful responses having errors or exceptions inside. Add View Results Tree listener to your Test Plan - it is capable of visualizing request and response details and inspect them carefully. If there are errors - fix them until you will be happy with your script behavior, after that the listener can be disabled.
You can also use JMeter Assertions, i.e. Response Assertion to validate whether response contains message regarding successful sign up.
Don't forget to add HTTP Header Manager to send the relevant Content-Type header as some API servers don't process the requests not having expected MIME type.
See Testing SOAP/REST Web Services Using JMeter article for more information on APIs load testing.

Resources