Apache Jmeter is not giving any error even we gave wrong credentials - jmeter

I am new to JMeter. I am using it for load testing for Microstrategy web dossiers. I am loading the users from CSV Config file. I have generated steps using Badboy software and exported as Jmeter file. I have added variables for userID and password. I have enabled "Retrieve all Embedded Resources". When I ran the testing. I observed that its giving same response even if password is wrong. taskProcs are giving connection closed error. I have searched with dossier ID in both the cases , I am able to see the request and response same even if password is wrong. Can you help me how to identify whether the credentials matched or not ? I would like to throw error when password didn't match ? I thought of adding Response Assertions but responses are same.

JMeter automatically treats HTTP Response Status codes below 400 as successful. So if HTTP Request sampler returns status 200 (or any other between 100 and 399) it's treated as success.
JMeter doesn't perform any checks for content, if you need to add explicit pass/fail criteria basing on the response body, presence or absence of certain text, sampler execution time, etc. you need to add a relevant Assertion and put the anticipated success criteria into the assertion.

First JMeter doesn't generate any error codes or error messages itself, what it actually do is working as client and giving back what application sends to JMeter.
I think first you have to make sure application works correctly, then check whether Jmeter scripts work correctly. For that add debug sampler before the API request and check whether variables username, password has evaluated correctly from the csv.

Related

Response message: Unauthorized in Jmeter

I'm new to using Jmeter tool.
I have recorded my application using blazemeter (v3.1) and then trying to run that .jmx file in Jmeter, however I am running into an authorization issue and the script fails to run.
I have also tried setting my "HTTP Authorization Manager" with username, url, password but it does not help. If anyone can, please guide me on this Issue. Thanks.
As per 4 Things You Should Never Do with Your JMeter Script article:
Don’t run the script exactly as you recorded it
After recording your script, there is still some work to do before you run it. It’s necessary to correlate variables, parameterize and add elements, to faithfully simulate users.
There are too many ways of possible authentication implementation in your application, most probably you need to send some dynamic value along with credentials which can be fetched from the previous request.
Record your test scenario 2 times and compare recorded requests. Be careful as differences might be in response headers and URL, not only in response data. It makes sense to add View Results Tree listener directly to HTTP(S) Test Script Recorder - this way you will be able to see what data is captured by JMeter and amend its configuration so simulated request would look exactly like the request from the real browser.

Jmeter CSV data set config run script correct even after providing incorrect username and password

I want to run performance testing using 100 users by using JMeter CSV data set config, I have added 100 different users in CSV file which are incorrect.
when i run the script in run properly, i was expecting it should show me the error than username and password is incorrect
JMeter automatically treads HTTP Status codes below 400 as successful, it doesn't do any extra checks.
So if your application responds with HTTP Status Code below 400 JMeter won't fail the sampler. If you need to test whether is user logged in or not add Response Assertion as a child of the relevant HTTP Request sampler and configure it to test whether response contains something which indicates logged in user, i.e. Welcome text or something like that or vice versa, that it doesn't contain elements of login page.
See How to Use JMeter Assertions in Three Easy Steps article to learn more about conditionally failing JMeter samplers using Assertions.

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.

1.wrong credentials is running pass in data driven-Jmeter

jmeter reads credentials from CSV. even if I have wrong credentials in the csv file (1/5login credentials) script shows successful.Does it check database while running? Which means 2 credentials is wrong, it supposed to shows fail, but it shows pass result(app angular JS type)
In the CSV file, I have 5 credentials and threads also 5...but in the output I got only 4 results
JMeter neither checks response nor database. In case of web applications JMeter automatically treads HTTP response codes < 400 as successful so if your web server responded with HTTP Status Code 200 (OK) - you will have "green" result even if your login wasn't successful.
You might wish to add i.e. Response Assertion to your request to ensure that response doesn't contain error messages or contain something, which indicates a logged in user, i.e. "Welcome" text or whatever.
See How to Use JMeter Assertions in Three Easy Steps article for more information on conditionally failing JMeter samplers.

Log data for wrong user login using Jmeter

I am using JMeter for performance testing. I have a set of users in a .csv file and am using csv config element.
Even if the login failed, it is showing that the request ran successfully. What is the way to get log data for users with wrong password during testing?
Go to Edit > Add > Assertions > Response Assertion
In response assertion you can assert by checking the response code, message and header.
If the assertion doesn't match then request will fail.
You have to add assertion to validate the response, so that if login fails it notifies the request as fail in test results.
JMeter automatically treats HTTP Status Codes below 400 as successful, it doesn't do any checks against response and knows nothing regarding login request being successful.
You can use Response Assertion in order to verify whether your user is logged in, i.e.
Check that text like Welcome, ${username} is present
Check that Logout link is present
Check that message regarding wrong credentials is absent
See How to Use JMeter Assertions in Three Easy Steps article for more details on conditionally failing JMeter samplers basing on various criteria.
If you're looking for a way to store username/password combinations somewhere so you could tell which ones were "bad" I believe the easiest option is using Sample Variables property.

Resources