Code 500/session timout in testing with JMeter - jmeter

Im testing right now performance of web aplication, based on Bonitasoft, using JMeter, but I had some problem with loging in.
I record test scripts with HTTP test script recorder, but one of requests (login) got response code 500 and server log shows that session is timed out.
I read about other similar problems and I have HTTP cookie manager, I use "Follow redirects", not "Redirect automaticaly". I didnt find any request with JSESSIONID too.
I will appreciate any help! ;)

I believe that JSESSIONID cookie will appear after successful login. You could try recording your traffic from web browser with a sniffer tool like Fiddler or Wireshark or whatever and compare what's being sent with a browser with the request from JMeter.
My expectation is that you're missing some login request mandatory value. You could try look into source code of your login page to see if there is anything similar to
<input type="hidden"..>
I guess that you're missing something like "viewstate" in your login request and that's why it's being rejected.
If my guess is correct you could use JMeter Regular Expression Extractor Post Processor to fetch dynamic values from page source and provide them in following requests.
For example if you have the following input:
<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="1ffVEvtAxEXyO+Mq561c58UaygSCfODTuKhiyBB7MATW+QQhvdmMhqtAU1AZey37+ZBtxx0Q0XfMl3v02hurmowb+bbxZHpBEJzcLPfE+e1ESTuA6mT6IUn5xH8=" />
You should be able to extract this value with RegEx like:
<input type="hidden" name="javax.faces.ViewState" id="(.+?)" />
The good place to test your regular expressions is Jakarta Oro Demonstration Applet

Related

How to save cookies in jmeter recording and replay

Here i have two questions regarding capturing the cookies through JMeter. I am using JMeter recording to capture the web browser flow . And i have added Cookies Manager under the Test plan (common for all requests) Below is my flow :
launch >select Providers >sign-In
While recording it is capturing the cookies properly . i am able to see in the "Request Data" in "View Results Tree" . But while trying to replay i am not seeing the cookies in the results.
Please let me know if i am missing some settings here.
How this will work when we increase the no of users and run.
Thanks In Advance.
JMeter doesn't record cookies, if you add HTTP Cookie Manager to your Test Plan it will automatically extract the cookies from the application's Set-Cookie response header, parse them, validate and send with Cookie header during the next request.
If you cannot see any cookies the reasons could be in:
Cookies are invalid (i.e. expired, not matching the domain/path)
Your test fails somewhere somehow, i.e. your sign-in request fails because you haven't implemented correlation of the dynamic parameters
Inspect response details using "Response Data" tab of the View Results Tree listener and ensure that your test is doing what it is supposed to be doing as it looks like it doesn't go further than first page in your case

Load Testing in Struts2 Application - JMeter

I am trying to do a load test using JMeter for the first Time.
My approach is to test each page one by one.
The main page is like http://localhost:8180/myapp/login.do?actionType=login(I hardcoded the credentials)
I am able to reach this page without any problem.
I created a HTTP request component and able to see the response without any issue.
In the main page there is a button which populates the report, in the browser , the url is like
http://localhost:8180/myapp/mainmenu.do
But when i create a HTTP request it is reaching but shows the security error page in the 'Response
Data' as Due to security reasons, we still recommend you to close this window.
can someone guide me how to test the other pages without these security errors. This is a struts2 Web application.
No matter what technology is being used under the hood of the web application you're testing you should stick to one simple rule:
Well-behaved JMeter test must send exactly the same requests as real browser
It includes:
Same number/sequence/nature of the HTTP Requests
Same HTTP Headers (including Cookies)
any dynamic values need to be properly correlated
Once JMeter will send the same requests as real browser does it should receive the same responses. So just use a 3rd-party sniffer tool like Fiddler or Wireshark to capture the requests originating from browser and JMeter and amend JMeter's configuration until the requests start looking exactly the same. This should resolve your issue.
Solved the issue by adding HTTP Cookie Manger and
set Cookie Policy as Standard
click HTTP Cookie Manager
and click save icon on the top.
Source
https://jmeter.apache.org/usermanual/build-web-test-plan.html#adding_cookie_support
Thanks #Dimitri T and #Roman C for their valuable suggestion.

Can't get authorized response on requests in JMeter, while they have the same CSRF token and sessionID

I'm having trouble with getting my site normally loaded during the performance testing in Apache JMeter. Firstly I recorded the script (by BadBoy), containing authorization and visiting some pages, unavailable without login. Next, I exported it to JMeter, configured Regular Expression Extractor to get the csrftoken from the request right before the authorization request and it looks like it works just fine:
no errors in http-requests
But if to look at the tab "Response data" of every post-authorized request, the content isn't like correctly loaded page, it just starts page with the empty authorization form, i.e. in some way session is new though all the requests have the same session id and csrftoken in Cookie Data and in Set-Cookie (Sample result), appeared in authorization request result.
HTTP Cookie Manager is added.
Did anyone face this trouble?
UPDATE: I've conducted an experiment with transferring cookies from Chrome to Mozilla Firefox, copied 'csrftoken' and 'session id', and - voila! - it worked, I got the same authorized session in two browsers. Still have no idea what's wrong with JMeter
JMeter automatically treats HTTP Response Codes below 400 as successful, it doesn't perform any checks of response body. Most likely your Regular Expression Extractor failed, add a Debug Sampler and double check resulting variable value.
There could be also the following possible reasons:
You might need to send CSRF token in encoded/escaped form so using i.e. __urlEncode() function will be required. Or vice versa.
Application may expect the token in multiple locations, i.e. not only as a form parameter, but as an extra HTTP Header. In that case you will need to pass it via HTTP Header Manager
You might also want to try the new step-by-step debugger for JMeter to get to the bottom of the issue.
This is the default behavior of this token. 1. make sure where these tokens are passed. It might be passed multiple times. Check the header. Generally, "xref-token" is again passed.
It should be in exact format, decode it if required, also remove , or ; or /. You can also use fiddler.
The solution was found after recording a script by Blazemeter plugin in Chrome and further exporting it in '.JMX' format. Adding an HTTP Header Manager like this (with its special fields, of course) to each HTTP Request solved the problem.

Jmeter Login Request with cookies have wrong Response

I m new in jmeter i want to know if i send post request for login with cookies then in Response below information is displaying .
Request Error We’re sorry, there was a problem with your request.
Please make sure you have cookies enabled and try again.
What could be going wrong.?
It may be not about the missing or incorrect cookies.
You need to provide valid loginCsrfParam value as well, it needs to be extracted from previous response via one of the following PostProcessors:
Regular Expression Extractor
XPath Extractor
CSS/JQuery Extractor
converted into a JMeter Variable and used as a parameter in your login request.
See How to Load Test CSRF-Protected Web Sites guide for comprehensive information on bypassing CSRF protection in your JMeter test.

Login post request does not work

I had a look at similar questions here, but did not find any dynamic parameter, session information etc which I need to get around using regular expression extractor to login post request.
The Network traffic on chrome seems same.
JMeter seems to pass all required parameters and and I also have HTTP cookie manager set up (as depicted in snapshot).
here is the JMX script. I have struggled with this seemingly simple use case for 1 day have been clueless so far.
I see some dynamic parameters.
To make it work,
Send a simple HTTP request to www.zalando.de/login
<input type="hidden" name="_sourcePage" value="WWScWmVVYn3uSAjDV0VmRUaxY8np_Kj8XwbKjpAM6Z4ZBx3a1i4qrAt340nPsm8WoPocLW1Uvy0=" /><input type="hidden" name="_xtk" value="A2tPiZQsZqyptrUdhhTxOxhmbJsyjPgwchzLFZyz41iFfo4uDoSYO0cYIR7gls6M" /><input type="hidden" name="__fp" value="47Scl-SCdBc=" />
From the HTTP response, Extract __fp, _sourcePage, _xtk
Send the login request by updating these values in thr HTTP request.
It should work now.

Resources