jmeter is not able to load content of homepage after login - jmeter

jmeter is not able to load web page after login page redirect to default homepage.
After starting recording with webpage url, it will redirect to login page and after submitting credentials, it will redirect to default homepage. jmeter is able to redirect to default homepage but not able to load its content. It looks like it is in loading state.
During recording i have unchecked FOLLOW REDIRECT and REDIRECT AUTOMATICALLY
if we open homepage normally , without jmeter recording, it is loading perfectly.

With the given information, I can't pinpoint the issue. But following is the useful information for debugging:
Understand http traffic i.e., getting generated when using the application. To capture the traffic, you can use browser builtin options (Chrome,IE and Firefox -F12-Networks tab) or wireshark, fidler etc. Delete the cache before you start.
Find the source/initiator of the request which loads the content of the user logged in.
Once you find the trigger/source point of the request:
a. If source is html file, then Jmeter will send the requests for embedded resources only if "Retrieve All Embedded Resource" is enabled.
b. If source is other than html, such as .js (in case of ajax requests), .css, then it is LIMITATION in jmeter, which wont parse these files to check for the requests to send, even if "Retrieve All Embedded Resource" is enabled.
So, if the source of the request (which loads content) is .js or .css, then we should explicitly add that request as a sampler (take care of other things, such as adding HTTP Cookie Manager, Header Manager etc., in case the request demands).
Meanwhile, please provide following information:
Does all http requests are recorded? Match with browser (F12) Networks tab.
If yes, what is the status of those requests, when replayed? Check using View Results Tree Listener.
If only parent/source request is recorded, then look whether it is sending the request/s (which loads the content) using View Results Tree Listener.

Related

Recorded script by blaze Meter & browser is showling all cookies but JMeter is not i.e. ai_user & ai_session, how do I get those cookies values?

Browser shows all cookies when we hit home request
These are the cookies that appear in browser when we execute home page 1st time, but not in Jmeter request
Its JMeter response that shows cookies
My issue is when I execute home page in browser it shows all cookies 1st time when we hit request but in JMeter home request don't show up all cookies as shown in picture.
I want cookies values i.e. ai_user & ai_session and pass them to UserSessionId & AppSessionId in HTTP request header. So how do I get those values? I already user HTTP CookiesManager in my script to handle cookies but can't get ai_user & ai_session cookies values.
Given you send the same request in JMeter as in the real browser you should get the same response so double check all the request details like:
URL
Headers
Body
etc.
Try using clean browser session or at least private mode
Look at Set-Cookie header for the first request and see if the cookies you're looking for are there. It might be the case that the cookies are being set by JavaScript and as per JMeter Project main page
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
So if this is the case you will need to mimic the JavaScript code logic using JSR223 PostProcessor or just extract the values from the response if they are there using other suitable Post-Processor

"/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

Why does JMeter HTTP Response differ from the browser response?

I have a magic link to access a website without logging in, let's say the magic link is something like this
https://key.example.exampl.tr/auth/realms/test/protocol/openid-connect/auth?client_id=my-react-client&state=ba453a80-d991-4b3b-a791-3fc2629aea03&redirect_uri=https://test.example.exampl.tr/&scope=openid&response_type=code&user_id=d0bcdd07-3198-4ab6-9cfd-d0b6341dbe00&key=7a1b4163-76e8-465c-a914-c68f16761698
when I use the link in the browser it works as expected and accesses the home page without asking me to log in. BUT when I use the same link inside HTTP GET Request using JMeter, it redirects me to the login page. Why is that happening and how to solve it?
This is happening as you browser stores specific cookies and caches for the particular request, whereas for jmeter you will request a new session every time, if you are not using HTTP Cookie Manager and HTTP Cache Manager explicitly.
Try clearing your browser history, cookies & caches and hit the same request/url, it would also redriect to the login page and behave same as jmeter does

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.

too many sessions created by Spring MVC

I'm using Spring MVC, MySql and Tomcat 7.
Currently the application I'm developing can be accessed by 2 URLs namely IP:PORT/APP and www.app.com.
When accessing via www.app.com I see a session being created for every page/link that I open but it doesn't happen when I access via IP:PORT/APP.
I have a check for logged-in user in every page and due to too many sessions that check is failing and I'm being re-directed to my login page even after logging in.
Also when opening the www.app.com index page I see a jsessionid on the address bar and not when i open it via IP.
Any help/guidance is appreciated.
It seems that when you are accessing the page via domain name (www.app.com), cookie support is not found and hence the url rewriting is being done (i.e. appending jsessionid at the end of the url). But this is not observed while accessing the same page via IP Address (IP:PORT/APP), meaning cookie support is enabled at this time.
You can check if you have enabled some security settings that is not allowing cookies.
Further to this, it seems that even url rewriting is not helping as sessions are being created for every request.
You can use some HTTP Interceptors to analyze the request being sent and response being received in each case. You can use Developer Tool in Chrome to inspect this. Load you page in Google Chrome, Right Click on Page and Click 'Inspect Element'. Open the 'Network' tab. Reload the page. You can now inspect the HTTP Request Headers sent and Response Headers received for each request. Analyze the difference between the request using IP Address and requests using Domain Name.
Also, share the architecture of the application and the environment where you are testing the application.

Resources