Why is only my first HTTP request running? - jmeter

I'm still pretty new to jmeter. I'm using jmeter 2.9.
I have created a thread group with two threads in it. I have set up an HTTP Request Defaults for the thread group. I have created User Parameters to define person IDs that I'm going to be working with in each thread.
I then set up two HTTP requests. One for login, one for retrieve person. For the login one, I created a regular expression extractor to extract the session key that comes back. I then supply the session key as the parameter for the retrieve person request.
I then sniffed the net traffic and started jmeter test. I wanted to make sure the session key was getting passed into the second parameter OK, but it appears to be running on the login twice and then ending. I am getting a 200 return on the HTTP packet and my jmeter test was set to continue regardless.
I believe I followed chapter 5 of the jmeter user manual to set up this test with the addition of parameters, user parameters, and the regex extractor.
Can anyone give me an idea what i might have done so that the second request never runs?

Add "View Results Tree" listener to see what jMeter is actually doing? You should also check jmeter.log to see if there are any exceptions while generating the 2nd request.

Related

Generate session ID in jmeter, blazemeter

Need to generate new AuthorisationId/sessionID for each user.
How is it possible to create a new for each user in jmeter?
If I am using the sessionID by recording, it is showing the session expired after an hour.
I don't think you should "generate" this sessionID, most probably you need to correlate it.
My expectation is that when you open login page or perform login the application responds with the sessionID either in redirection URL or in response body or in response headers
First of all try adding HTTP Cookie Manager, it might be the case it will be enough to resolve your issue.
If not, you will need to identify where this sessionID is coming from and use the suitable JMeter's PostProcessor to extract the sessionID and store it into a JMeter Variable. Once done you should replace recorded hard-coded value with the JMeter Variable from the previous step.
Check out Using Regular Expressions to Extract Tokens and Session IDs to Variables article for more information, if you will experience problems - don't hesitate to ask new question, but this time provide more at least partial response showing where this sessionID comes from and how you pass it to the application.
You need to correlate it. Just use postprocessor extractor-regular expression. Replace the hard-coded values with the variable.

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.

Running Jmeter for Https app with single user for multiple times through Loop controller

Attached is the snapI am trying to run jmeter for single user with value of 10 in loop controller , I first login into the app and then subsequently uses the CSRF token accordingly for future request .The login is always successful and generates CSRF token, But when i try to use CSRF token for future request , I get unauthorized HTTP 401 reponse code , when running with value 10 in loop controller for single user , the same works when i try to run single user with value 1 in loop controller , Any idea how to fix this? (Note :- All this is present in same thread Group)
Well-behaved JMeter test should be able to loop single user without any problem, most likely you have a problem with your test design or mismatch with the application under test behaviour. General recommendation would look like:
First of all switch to iterations on Thread Group level, JMeter configuration elements don't respect iterations originated from elsewhere as "iterations"
Add Debug Sampler and View Results Tree listener to your Test Plan
Run your test with 1 user and 2 loops
Inspect request and response details, identify missing/extra/different parameters and fix them. See How to Debug your Apache JMeter Script for more details on JMeter test troubleshooting techniques.
Blind shot: your test includes login request and the virtual user is already logged in therefore it doesn't require login on 2nd loop. In this case you have 2 options:
Put the logic which needs to be executed only 1 time under Once Only Controller
If you use HTTP Cookie Manager be aware that Clear cookies each iteration works only on Thread Group-level iterations

Session handling and count with jmeter

I am trying to test my website performance using JMeter. I just started with login implementation. After logging in my website displays the number of users logged in at the instant.
I am able to see different number sessionId created for threads in JMeter but the count is not getting updated.
Could anyone please suggest me on this.
Depending on what your "counter" count you may need to configure JMeter differently.
The most straightforward way is adding HTTP Cookie Manager to your Test Plan and given your test is using multiple iterations tick Clear cookies each iteration? box.
If users are being counted basing on something else you need to figure that out and amend your Test Plan accordingly, it might also be some HTTP Header so you will have to send different headers for each user via HTTP Header Manager

Session Expired Response in JMeter

I am testing particular application using JMeter 2.9.There My test plan is Thread group--> Transaction Controller.Inside that various recorded requests are there.I am using HTTP request defaults,HTTP Cookie manager and HTTP header manager,and a view result tree for validation.I found one token i.e. CSRF token to be correlated and I did correlation.But for a particular request I am finding "Session expired..Login again" response much before the logout request.My transaction flow is to Login--> Search a content-->Logout.
Please help me finding a solution.
Try put the element: HTTP Cookie Manager in Thread Group, first item.
the problem can be in the following areas:
-you were redirected automatically instead of following redirects
-login hasn't succeeded
-the session id has not been successfully passed on to the request after login
The JMeter documentation states this:
I've set up JMeter to sample the same URLs as my browser, why is JMeter not seeing the same responses?
There are various different reasons for this:
Cookies - make sure you added a Cookie Manager. Browsers process cookies unless you set them up otherwise, but JMeter does not process cookies unless you add a Cookie Manager.
User-Agent - the User-Agent is a header that is sent by browsers; it identifies the browser type. Some servers are sensitive to this setting and generate different results for what they think are different browsers. The Header Manager is used to add headers such as User-Agent.
Hidden fields - if you did not use the JMeter Proxy (or other application) to record the test plan, then it is easy to miss hidden fields from forms.
Dynamic field names/content - some servers use varying names for fields. So although the test plan may be correct at the time of creation, it does not work when replayed.
URL rewriting - TBA
from http://wiki.apache.org/jakarta-jmeter/DifferentBehaviour

Resources