I created a test script by BlazeMeter chrome extension. In my test there is simple GET request fo getch the home page:
It redirects user to another page and makes other GET requests to get static assets. I would like to exclude url cloudfront from subsequent http calls. Is this possible?
There is a special field under "Advanced" tab of the HTTP Request Sampler (or even better HTTP Request Defaults) which allows you to filter out the unwanted domains for example if they're "external"
More information: Excluding Domains from the Load Test
Related
I used the Blazemeter Chrome plug-in to record. When the UserID is checked, browser is redirected to another URL. This redirect is recorded in the script.
Want to ask:
I read that the redirect will occur during the UserID check if I have Follow Redirects checked ? Is this correct ? The reason I ask is that I saw some extra HTTP request generated but they are not the same URL as the redirect which was sent from the server.
So I can actually just remove the redirect URL recorded ?
Thanks.
Your JMeter test must generate the same network footpring as the real browser does
So you can use a sniffer tool like Wireshark or Fiddler to compare the number/nature of the requests which originate from JMeter and from the real browser, the requests must be exactly the same (apart from dynamic parameters which needs to be correlated)
If HTTP Request sampler redirects automatically and the next request basically duplicates the redirected one - remove the recorded one.
If automatic redirect is causing troubles and you're not able to extract dynamic elements because they're "hidden" in 2nd level of sub-results - disable redirection in the HTTP Request sampler and leave the recorded separate request which mimics redirection.
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
I noticed this when analyzing wireshark. under thread group those requests are:
homepage/Account/Login
homepage/
homepage/LiveAlarm
and so on.
on wireshark there are some other requests that jmeter sends. but when i test this with browser, that requests wont be send.
after request 2)
HTTP GET /Content/css?v=........... HTTP/1.1\r\n
HTTP GET /Content/cus-css-plugins?v=......-..... HTTP/1.1\r\n
HTTP GET /images/logo/logo.._...png HTTP/1.1\r\n
and so on, totally 6 inintended requests are sent. there are not in the sampler list. and not sent when using browser.
the test script is recorded by blazemeter chrome plugin.
another unintended request
HTTP GET /signalr/hubs HTTP/1.1\r\n is sent by jmeter, but it is also sent when using browser.
because it is not in the sample list, the "Accept" field is very different between browser and jmeter. it is another issue. so, should i add this request to jmeter manually and control the fields?
BlazeMeter Chrome Extension generates a JMeter Test Plan with HTTP Request Defaults configuration element configured to "Retrieve Resources from HTML Files"
This is normal as it replicates real browser behaviour, real browsers download the HTML content from the response and then execute parallel HTTP Requests to download images, scripts, styles, fonts, sounds, etc. and this setting instructs JMeter to behave like a real browser when it comes to these embedded resources handling.
If you open your browser developer tools you should see the same requests (just tick "Disable cache" if you don't see them)
More information: Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses
I'm trying to record a script in JMeter. I'm getting a 401 error in the login request. I see that the login request is sending a token to the server and I have to correlate this token however I'm not able to find any token in the response body or response header of any previous request. What should I do?
There are 4 sources where the "token" could come from:
Response body
Response headers (including cookies)
URL (as a result of a redirection), if this is the case you might need to play with Redirect Automatically and Follow Redirects checkboxes in the HTTP Request sampler (or HTTP Request Defaults)
The token can be generated by JavaScript. 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 have to replicate the logic of the associated JavaScript function(s) using JSR223 PreProcessor
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.