JMeter HTTP Request shows a second failed result of a wrong URL - jmeter

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

Related

Jmeter API testing using csv input as post request in localhost

I tried to run a POST method for API testing in JMeter, I have sent the parameters as needed in body using a csv file. It works with https url(domain url) but not working in localhost. In localhost, requested body is showing blank. Please help me to resolve this issue.
There should be no any difference between local and non-local URLs so most probably you made a configuration mistake somewhere. We cannot state where exactly without seeing the test plan so I would suggest:
Inspect request and response details using View Results Tree listener
Ensure that the variables originating from the CSV Data Set Config really exist and have their respective values by adding a Debug Sampler and seeing what variables are there.
Check jmeter.log file for any suspicious entries. If it doesn't say anything meaningful you can try increasing logging verbosity to DEBUG level.

JMeter embedded resources being downloaded when disabled

I have recorded a simple get/post test using the Blazemeter chrome plugin and am tweaking it in JMeter to be ready to use. However, the test fails because one of the embedded resources fails to load, which if it was correct, would be understandable.
I don't know if I am not understanding what I am seeing in the View Results Tree listener but I have some questions:
I don't need to download embedded resources but even though the box is NOT ticked on the http requests, they are still shown as downloaded. However, for the GET, these are dowloaded successfully.
I think that the post is failing and the same page is being returned by the server but when it comes to reloading the embedded resources, they all succeed except for one to fonts.googleapis.com, even though the same request always works for the get request
The failure is always the same each time I run it. Always, the embedded resources download correctly with GET and always that single 12th request to google fails with a 400.
Please can someone advise how to 1) Actually stop embedded resources from being downloaded and 2) work out how to debug why a second request to the same resource always fails even though it is simply an embedded font?
JMeter Chrome Extension adds HTTP Request Defaults configuration element which populates the values for all the HTTP Request samplers in its scope. So if you don't want to download embedded resources (although it's not recommended) you need to open "Advanced" tab of the Defaults configuration element and untick the box there
There is a special property which controls whether a problem with fetching an embedded resource is treated as failure or not, if you would like to download embedded resources but at the same time to ignore failures you can add the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
upon JMeter restart problems with embedded resources won't fail the parent HTTP Request sampler. See Configuring JMeter user manual chapter for more details if needed.

How to ignore broken resource to getting failed HTTP requests in JMeter

I'm having trouble with the option Retrieve all embedded resource option in HTTP request Advance tab as it retrieve all resources and if there is any resource broken whole Sampler getting failed. Is there any method to avoide sample getting failed due to resource failures (Ex favi.ico).or is there any similar option as such in Loadrunner : List non critical resource errors as warnings
Failing of the parent HTTP Request sampler by the underlying embedded resource failure is controlled by httpsampler.ignore_failed_embedded_resources property.
If you want to permanently "tell" JMeter to ignore failures of the embedded resources - add the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
If you want the change to be ad-hoc - you can pass the property via -J command-line argument like:
jmeter -Jhttpsampler.ignore_failed_embedded_resources=true -n -t test.jmx ...
References:
Miscellaneous configuration
Configuring JMeter
Overriding Properties Via The Command Line
Apache JMeter Properties Customization Guide
In my experience, you should be able to remove the unnecessary resource by using a GET method request with some setting like the HTTP Cookie Manager, HTTP Cache Manager and User Defined Variables.

File upload fails during recording using JMeter

I attempted to record a file upload in JMeter, using port 8888, but the file failed to upload when using JMeter as the proxy ( Recording Controller and HTTP(S) Test Script Recorder ). I also tried to run this from within JMeter by choosing "Start" and viewing what I had just recorded in the View Results Tree listener. When I ran it this way, I received a 500 error for the file upload line in the View Results Tree listener.
So, I ran Charles network proxy while doing the file upload to see if the same thing happened. It did not. I was able to successfully upload the file going through the Charles network proxy on the same port 8888.
Furthermore, I took out all proxies and did the file upload successfully.
Only when I use JMeter as the proxy do I have a problem uploading the file.
In JMeter, after first running it with no changes, I then tried to change many settings like Implementation, Content Encoding, Browser-campatible headers, Retrieve All Embedded Resources, and many others to see if this would help, but it did not.
So, my gut tells me that there is a setting that is set incorrectly.
I found this post that talks about changing to use "Java" in the HTTP Request Defaults. ( Unable to upload image/file when using Jmeter HTTP Proxy server ) This did not help me though when I tried that.
I found this post also which mentions some other types of things ( Unable to record an upload file scenario in JMeter though it is possible by manual effort with specific browser settings ) . I did check the headers against Charles and they look the same.
Any ideas?
============= Edit below is adding the test plan screen shot===============
During recording you need to put the file you want to upload in jmeter/bin folder.
This is due to some limitations of browsers which do not transmit the full path.
So, apparently, I had to remove the parameters from the "Path" line and move them to the "Send Parameters With the Request:" for the line that I had the 500 error on ( the highlighted line in the screen shot I had attached above ).
In summary, here is what happened. When I recorded the file upload with JMeter using the Recording Controller and HTTP(S) Test Script Recorder, JMeter had put all of the parameters in the "Path" field for me on many of the lines that JMeter had recorded for me. I did not even think twice about what JMeter had done automatically for me. So, after I removed all text except "/" in the "Path" field and added each parameter one at a time under "Send Parameters With the request", I received a "200" status code on the line that had given me the problem. I also went into all other lines and made these same changes for the parameters. I still am not sure if the file upload is actually working, but I don't care about that right now since I did get a "200" on the line that was giving me a problem. That is enough progress to keep me moving ahead... :-).

Unable to record an upload file scenario in JMeter though it is possible by manual effort with specific browser settings

I am working on upload file module that works on internet explorer only and it requires following browser setting mandatory:
"Include local directory path when uploading files to server" should be enabled.
A failure message "Unable to upload file" displays when we do not make required setting in browser while manual attempt else it works fine.
Now when I am trying to record the scenario in JMeter, getting same error message even I made required browser settings.
Note: Additionally, I tried to include these calls by copying from browser tools and paste it in JMeter transaction but get the same result in response.
Have any one experience the same or can help me out?
Thanks,
Nitin
Few things to consider:
Make sure that you use Java implementation of HTTP Request
Make sure that "Use multipart/form-data for POST" is checked
Make sure that you provide a file within "Send Files With the Request" field providing correct path, parameter name and mime-type
If all above has already been applied and you still experience problems I would recommend to capture the data being sent by Internet Explorer with a sniffer (Fiddler, Wireshark, etc.) and compare it to data, being sent by JMeter. They must be the same. If they aren't - you'll need to customize it using HTTP Header Manager, HTTP Cookie Manager, etc. If JMeter is not flexible enough to set all the required parameters via GUI, i.e. still tries to send full path of file instead of just filename or vice versa, you can always go deeper and manually build multi-part post request via Java Request Sampler (see SleepTest and JavaTest source code for details) or via Beanshell which is 100% compatible with Java syntax but may be harder to debug due to it's script nature.
Path to SleepTest and JavaTest files is follows:
/src/protocol/java/org/apache/jmeter/protocol/java/test/JavaTest.java
/src/protocol/java/org/apache/jmeter/protocol/java/test/SleepTest.java
JMeter sources are available from JMeter download page
Steps to upload the image using jmeter:
locate the image in bin folder Select Post method and check the "Use
multipart/form-data for POST" in HTTP Request
Provide details of Send files With the Request in HTTP Request
Record the Upload scenario and stop button in Jmeter (Image wouldn't upload while recording in Jmeter)
Now before running the script, Go to upload response and give the full path of image in "Send files with request field"
Now Run the script. You can able to see the image

Resources