1.wrong credentials is running pass in data driven-Jmeter - 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.

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

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

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.

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.

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