Finding difficulty in understanding Jmeter functionality [closed] - jmeter

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have recorded one scenario in JMeter. Scenario is, I will login to the application, perform some Registration and logout. when i run/execute this, Login is failing for some reason(i have figured out login failure issue), but my question is, 'Registration' part is executing successfully. whatever 'Success' i am receiving for registration without login, is a correct functionality of the jmeter? i am very new to jmeter, trying to understand how it works.
One more question is, when i execute more than 1 thread(may be 100 or 1000), how does it do the load testing(Does it actually inserts data/values into the database)?

JMeter automatically treats HTTP Status Codes below 400 as successful, so i.e. if HTTP Request sampler gets HTTP Status 200 - OK - JMeter will "think" that everything is fine.
So if you need to add validation of the response data, i.e. whether it contains Welcome text or does not contain Error text you can add a Response Assertion to implement pass/fail criteria in your JMeter test.
Similarly you can use JDBC PostProcessor to validate whether required data is present in the database, check out The Real Secret to Building a Database Test Plan With JMeter guide to learn how to set up JMeter for DB connectivity and execute queries.

JMeter doesn't have any server logic, It just sends requests as defined by user.
The logic is in your server, If it allows registration without login (which seems ok) it will allow it and insert data to your database.
Load test will send similar request in a bulk, so same server logic will be executed, and if server won't block it, it will execute same flow as executing 1 thread which will probably include also inserts data into the database

Lakshmikanth,
You need to follow below steps when you are developing new scripts in JMeter:
Record your scenario through JMeter proxy
Look for the dynamic variables such as session id or token and correlate them
Add assertions [JMeter mark the request as pass or fail based on the response code ie. 200, 400 etc so its important that you set the assertion at every step otherwise the JMeter will mark the request as pass if it receive 200 response code similar to your case of registration]
Run script single & multiple users with 'Results View Tree' element enabled.
The above steps will help you to make a concrete JMeter scripts.

Related

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.

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.

My Application allows one user opeartion one at a time but jmeter is able to process the same request multiple time simultaneously withoutany error

My Application allows only one user to login/perform any operation at a time but jmeter is able to do the same process/request multiple times without throwing any error using same user credential simultaneously. I've used record and play function of Jmeter and it is able to do the same request multiple times without throwing any error. I have used multiple users in my thread group that's why it is doing same request multiple time but this should be shown in red or fail as my application support that one user can be used only once to perform any operation.
JMeter doesn't perform any checks of the response content, it automatically considers HTTP Response codes below 400 as successful.
If your application displays an error message - JMeter won't automatically check for it, it just measures response time. You can add i.e. Response Assertion to add a check that response contains what it should contain or vice versa, that it doesn't contain patterns like "Error" or "Exception" or whatever.
See How to Use JMeter Assertions in Three Easy Steps for more information on how you can conditionally set pass or fail criteria in your JMeter test.

how to multiple users login and logout in jmeter?

300 users Login the site.
300 users used to create the business process.
300 users logout the site.
what are the controllers and samplers need?
I have tried some of the my own examples. But i did not get the solution. Someone give the solution briefly.
Thanks in Advance..!
If you are testing a web application, follow these steps:
Record the workflow
Use the HTTP(S) test script recorder to record all the requests. Follow the steps here
or you can manually add the required HTTP Request samplers.
Parameterize your script
For example,in your case you can parameterize the users using CSV data set config.Refer this.
Correlation
For correlation, i.e. fetching a value from the previous response that is used by the current request,use Regular expression extractor(post processor).Refer this link
You can add the 'View Results Tree'Listener and execute the test plan to check the requests/response and validate your script.
To get distribution of 300 for login/ 300 for BP / 300 for logout the best option is to use Throughput Controller. See Running JMeter Samplers with Defined Percentage Probability guide for details.
To conditionally fail sampler basing on this or that criteria you can use Response Assertion. JMeter automatically considers 2xx and 3xx HTTP response codes successful, even if response says "Failed to log in" so you can use Response Assertion to ensure that response contains some piece of text specific for logged in user or something

Save response from certain WEB resources while recording scenario

I need to create scenario for user interaction with single-page WEB application. The application does lots of AJAX calls in order to authenticate user and get user data.
So I created simple scenario with HTTP Test Script Recorder and tried to record my script.
Everything went well, however I noticed that whilst request data is recorder properly, the response data is not recorder at all. I tried to enable Add assertions and Regex matching - but that didn't work as well.
Can you please advice how do I record response texts as well?
View Results Tree under proxy will record request, responses during recording.
This is useful to understand where a dynamic field comes from. This will help your find from which response X you need to extract data to inject in request X+N.
I think you may find this option useful to add in user.properties:
proxy.number.requests=true
This will give a number to each request and corresponding sampler so you will be able to find response for the request.
Once you have done this, you will start adding Post Processors (Regex, CSS/JQuery, XPAth ...) to Sampler X to extract data from its response.
This will create variables you can then use as ${varName} in request X+N.

Resources