Being a beginner in Jmeter, met with necessity to run a simple flow:
To log in web-app using webdriver sampler
To get & store cookies
To make GET/POST requests within the web-app (e.g. navigate to any inner page)
Test runs succeed for http://, but failed on HTTP-request step with 404 for https:// (two different sites)
What has been done to resolve:
1. Cookie Manager was added to Thread Group, placed prior Samplers
2. jmeter.properties changed to:
CookieManager.allow_variable_cookies=true
CookieManager.save.cookies=true
CookieManager.check.cookies=false
Thus, after changing save cookies to true, I expected to see all cookies saved in Debug Sampler > JmeterVariables, but I don't (either for http:// or for https://)
3. Regexp extractor (placed above HTTP sampler) used as:
Reference Name: COOKIE_EXT
Regular expression: SSESSee2ec8d6b6eedd096cb782a386b4e5c3=(.*)
Template: $1$
Match No.: 1
Use empty default value
Put in GET request as:
name: cookie_ext
value: ${COOKIE_EXT}
As a result:
Response in Debug Sampler: COOKIE_EXT=
Request data: GET ?cookie_ext=
[no cookies]
4. Tried to find any additional Jmeter settings for https (e.g. TSL/SSL protocols). Seems there are no any required except specifying 'https' in HTTP sampler template. Played with Implementaion & Cookie Policy in HTTP Cookie Manager, but without effect.
What could be the reason?
(Jmeter 3.0, Google Chrome 51.0, Drupal 7.43)
I haven't seen any problems with handling cookies and HTTPS protocol so maybe you have misconfigured something.
Remember a couple of things:
Any properties changes should be done in user.properties file
You need to restart JMeter to pick the properties up
Given you have CookieManager.save.cookies=true you are storing cookies into JMeter Variables already, there is no need to use regular expressions. Moreover, in case your regular expression is wrong (it seems very weird to me) you may overwrite "good" cookie from the HTTP Cookie Manager with "bad" value from the Regular Expression Extractor.
See Using the HTTP Cookie Manager in JMeter guide for more information on working with cookies in JMeter
Related
I want to send HTTP request to a particular URL in JMeter to do performance testing, but the URL is containing a environment name in its prefix ex: http://dev-www.abc.com/. while I'm running the particular script its failing because of the URL prefix.
How to achieve this?
If you are enter server name / IP as per screenshot below then it is wrong
Protocol and server name have to be given separately as below
If you already have setup URL like the screenshot above, please update the question with screenshot of failure message
Your question is not very clear, going forward consider adding:
output of the View Results Tree listener showing request and response tab, preferably both data and headers
jmeter.log file, preferably full, or at least any messages of WARN and above severity
A couple of "blind shot" answers:
If you're asking for a single configuration point which will be applied to all HTTP Request samplers - it's HTTP Request Defaults
If you're building your request URL dynamically and getting Illegal character found in host: '/' error - make sure to put the URL into "Path" field of the HTTP Request sampler:
I'm having a bit of a strange problem with JMeter that almost seems like a bug. I'm running version 5.1.1 r1855137.
I have a standard HTTP Request Sampler and an HTTP Cache Manager. The HTTP request is set to Follow Redirects. It is also set to Use KeepAlive, and to download all embedded resources with up to 6 parallel downloads. The Cache Manager is set to Clear cache each iteration, and to use Cache-Control/Expires headers. A limit of 5000 elements in the cache is set.
I've create a thread group with a loop controller in it. The HTTP request sampler is inside this thread group and loop. The page in the initial request returns a HTTP/1.1 302 Found. I also notice that in the headers there is Cache-Control: private, s-maxage=0. The first time through the loop, JMeter follows the redirect and downloads all of the resources. Subsequent assertions are fine. The second time through, JMeter only sends the request for the initial page and then does not follow the redirect. Following assertions fail because objects are missing that I'm expecting to find in sub requests.
I know this is a cache issue, because if I remove the Loop Controller in the thread group, and instead make the thread group loop, the problem will go away IF I leave the option to "Clear cache each iteration," checked on the Cache Manager. If I turn this option off, the same problem occurs when the thread group loops.
Does anybody know why JMeter does not follow 302 redirects when the cache manager is active? Is the website not following proper protocol by providing a Cache-Control header of private, s-maxage=0?
Looking at JMeter source code, JMeter caches 2xx and 304s. And GET requests. See: https://github.com/apache/jmeter/blob/master/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/control/CacheManager.java#L355
So it should not be caching your 302s. Have you tried using Redirect Automatically option to see if that works correctly:
I am working on a Jmeter login script. To create this script I used blazemeter. The thing is that it is not working correctly as I get a http 403 response code.
Thanks to fire fox I know that in my header I need to send the next data whenever I do a GET to the web page:
This is how I do it in JMETER:
Extractor:
This is the response:
The problem I am having is that the session id is not working correctly. I dont know if this is the problem why I have a 403 response code but it is still a problem. I tried everything to solve this error code but I failed so I need to start from the beginning
Look at this:
Do you have any suggestions to resolve this problem of the sesison id? If you do, I would really appreciate it
UDPATE:
I changed the variable in the petition because I was naming it wrong but I am still having issues. No id appears:
You're trying to extract Cookie value from the response message, switch the Regular Expression Extractor to the Response Headers (Cabeceras) and your approach should start working:
Also be aware that you don't even need the Regular Expression Extractor.
Add the next line to user.properties file:
CookieManager.save.cookies=true
Restart JMeter to pick the property up
Add HTTP Cookie Manager to your Test Plan
In the HTTP Header Manager (Gestor de Cabecera HTTP) refer the extracted value as ${COOKIE_GX_CLIENT_ID}
My results tree shows a separate status for a URL connection I have absolutely no idea where it might come from:
The first result with the -0 at the end is that of the request I send willingly. The other connection with the -1 comes out of the void.
In the response body I can see that JMeter fails while trying to resolve the DNS name:
java.net.UnknownHostException: aida.xyz.removed
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source)
This is my definition of the HTTP Request:
As you can see this goes to a totally different host and protocol (http instead of https).
I checked the defined csv, it does not contain the hostname "aid". Same goes for the JMX file and any environment variables set.
I am using Apache JMeter 5.0
After I read Ubiks answer I checked if there are any redirects in the first request. There are no redirects but in the content there are several script and img resources.
It looks like JMeter parses the first request for resources it has to download. But I didn't enable this setting / don't even know where to activate this.
I guess it’s either a redirect issued from response to the first request or because JMeter tries to download embedded resources.
Check the response of first request.
If the reason is that JMeter downloads (probably missing) resources, make sure you disable Retrieve All Embedded Resources in the Advanced tab.
The error you're getting indicates the problem with the system under test, JMeter cannot resolve an embedded resource - image, script, style, font, iframe, whatever.
You need to raise an issue as not available content is not good i.e. for SEO purposes, moreover it might be essential for your application functionality of LAF
If this is a known issue which is in process of fixing (or considered as won't fix) you can turn JMeter's check for embedded resources presence by adding the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
JMeter restart will be required to pick the property up.
More information:
JMeter Properties Reference
Configuring JMeter
Apache JMeter Properties Customization Guide
JMeter - Parameterization(using CSV data),
JMeter - In My local UAT Server same URL request not hitting second time(Error- 500)
In My local UAT Server same URL request is not hitting second time it's displaying a Response code like - 500.
I generate script by using blazemeter chrome addons V.1.5.184.
Kindly give any solution for this.
It is not possible to suggest anything without seeing request details, response message, response body, your CSV Data Set Config details and partial CSV file.
Most likely your parameterization doesn't work as expected, I would recommend comparing what's is being sent in 1st and 2nd request using View Results Tree listener and double check variables coming from CSV using Debug Sampler. See How to Debug your Apache JMeter Script article for more details on JMeter tests troubleshooting.