JMeter - Error in URL Redirection - jmeter

I was trying to issue a https request through jmeter and observed am getting Error Page response data for login page (Post Method).
login page url redirecting to different url (i.e. Application Home Page) but my login page redirect to the Error page.
And for Post req sampler i got error code 302 - Object moved to here.
Any help in resolving this issue would be a great help.

Probable https server that does not give a certificate or certificate must specify clearly in jmeter

This sounds like you're not handling some dynamic authentication token which is required in the post data or in the HTTP header.
There is probably a dynamically generated auth token on the page of the form itself (or the HTTP header) which you need to use instead of a static value.
You can capture the dynamic value with a post processor regular expression and then pass it in to the next request with the updated value.
There is a JMeter webinar which also covers exactly this scenario and how to solve it:
https://www.youtube.com/watch?v=cv7KqxaLZd8
UPDATE 1:
Sound like you're testing an asp.net application. They can be very finicky with JMeter. Check out these articles and other SO solutions:
asp.net login testing with jmeter
http://wiki.apache.org/jmeter/JMeterTesting/ASPNETViewState
How to use JMeter for load testing ASP.net web applications implementing viewstate

Related

"/Error?aspxerrorpath=/Home/Index" I am getting this every time I run my jmeter script

I run my script and this **********.com/Error?aspxerrorpath=/Home/Index redirecting to this url in jmeter in request section of my jmeter and showing 500 error. I am not able to get the proper url redirecting to the errorpath page and also showing the error if I uncheck the follow request in repond it is showing the same url
Most probably your login request fails somewhere somehow therefore redirect to /Home/Index page fails as you're not authorized to see it.
Use View Results Tree listener to see request and response details and cross check them with what you see in your browser developer tools - the requests should be exactly the same (apart from dynamic parameters which need to be correlated)
Once you amend your JMeter configuration so JMeter would send the same requests as the real browser does your script should start working as expected.
You may find ASP.NET Login Testing with JMeter guide useful, it gives a real-life example of handling the specifics of ASP.NET applications load testing in JMeter

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.

How can I resolve a 403 response code in Jmeter?

I am working with Jmeter to do load testing. I created a simple login script using BlazeMeter. Then I imported the file into Jmeter.
Whenever I try to run the script, it fails. The first problem I encounter here is that in my first http request I receive a 403 response code:
I added a cookie manager and an authorization manager to try and solve this but it is not working. I think the problem is with cors in the manager header as 403 code means that it received the petition but the access to it was denied. Do you have any suggestions on how to resolve this? I tried adding post processors but couldn't make them work. Maybe because I am a newbie to jmeter and load testing. Idk.
As per HTTP Status 403 description
The HTTP 403 Forbidden client error status response code indicates that the server understood the request but refuses to authorize it.
so most probably your request is missing some authentication context.
Your recording seems to be incomplete, you seem to be testing a GeneXus-based application and it is using AJAX_SECURITY_TOKEN header as the security parameter.
From your screenshot it seems that you're sending recorded hard-coded value, however you should design your script as follows:
Perform initial request, i.e. open login page
Extract AJAX_SECURITY_TOKEN header value using Regular Expression Extractor
Substitute this e8985.... recorded value with the JMeter Variable from the Regular Expression Extractor
Check out Using Regular Expressions to Extract Tokens and Session IDs to Variables article for more information.

Get CSRF token in Jmeter for salesforce load-testing

I am trying to do the load testing of salesforce.com. I am logging via test.salesforce.com which is redirecting me to the console url. Now, subsequent post request accepts following post parameters.
ViewStateCSRF
ViewStateMAC
visualforce.ViewState
But this post request is failing with "invalid session" error message.
I am guessing this is because of CSRF token. I am trying to extract(post processor in Jmeter) CSRF token, but I am unable to find this token anywhere in the response/cookie of previous requests. In one of the HTML response, I can find few CSRF tokens(e.g: runApexCsrfToken, consoleAjaxCsrfToken etc). I have tried all of them but no result.
To summarize my problem: I need to pass csrf token in post login request but I am unable to find this token in previous responses.
Could you please help me with this.
PS: I have tried get request on "https://c.salesforce.com/libs/granite/csrf/token.json" after login but did not find any token in response.
Make sure to add HTTP Cookie Manager to your Test Plan
Make sure to check all response fields as the token can be a part of URL or come as a HTTP Header
You need to correlate not only ViewStateCSRF but all other dynamic parameters as well
If you have problems with identifying the source for the dynamic parameters values you can try recording your scenario using cloud-based proxy service, it is capable of exporting recorded scripts in "SmartJMX" mode with automatic detection and correlation of dynamic parameters. See How to Cut Your JMeter Scripting Time by 80% article for more details

Same POST works manually, results in 500 error via Jmeter

In my script, I'm using a JSESSIONID instead of a cookie; the JSESSIONID is extracted using a HTTP URL Re-writing Modifier and I can confirm that the correct value (the one which appears in the response data from the login page) is being applied in the Request.
e.g. POST https://qa67.ososinfo.org:446/Staff/staffdetail.xhtml;JSESSIONID=0655ca5420354753ae413984d34cfc27
I'm also using a VIEWSTATE, which I'm extracting prior to running the remainder of the test steps by using a Regular Expression Extractor and setting the resulting variable as a parameter in the HTTP Request,
e.g. javax.faces.ViewState=8d2%2BgOIseczB2FWSo74DqQfkmiYVaK73D8bnLTNWCx%2FB8EtE
The problem is that I'm hitting a Response code: 500 | Response message: Internal Server Error every time I attempt a post with all of the applicable data.
I tried running through the steps manually in a Firefox browser. I copied the contents of the Request tab from the failing page into a REST client, logged in using a separate tab of the same browser and grabbed the appropriate JSESSIONID and VIEWSTATE information, then posted with that info in place - and the manual post was successful.
Am I missing something? Is JMeter requiring something to accomplish this POST that a I'm not seeing in a manual attempt? Please note that I can verify the test is working through the point of login - I can manually see the jmeter user logged in from an admin screen.
Happy to share any/all of what I'm seeing if it might be helpful in helping to troubleshoot.

Resources