Getting erorr 404 while replaying - jmeter

I recorded a script through chrome extension. but when I replay the script
got error ,I checked in view result tree and expand the sampler there are plenty of files in which a .js file is throwing 404 error.
How can I remove this file(Sample)
Help Please!
enter image description here

You can turn off failures reporting for embedded resources by adding the next line to user.properties file (lives under /bin folder of your JMeter installation)
httpsampler.ignore_failed_embedded_resources=true
JMeter restart will be required to pick the property up.
You can also pass this property via -J command-line argument like:
jmeter -Jhttpsampler.ignore_failed_embedded_resources=true .....
See Apache JMeter Properties Customization Guide for more information on different JMeter properties types and ways of setting and overriding them

Related

Jmeter Favicon how to exclude?

I did record with blazemeter a test.
Now it is giving me this error The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. at the favicons.
Is there a way to exlude it from the jmeter script?
Or what is another solution?
If the favicon is a separate HTTP Request sampler - add a Response Assertion to it, tick Ignore status box and set the expected response code to the actual one
If the favicon comes with the "embedded resources" you could add the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
and after JMeter restart the problem should go away

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

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

"HtmlUnit" Driver with Jmeter shows errors in javascript

I'm trying to add a "WebDriver Sampler" in Jmeter with "HtmlUnit Driver Config". Have written a simple come, which opens a webpage. But in the back ground, there are tons of errors / warnings related to JS and CSS, present in the web page.
Something like this
2018-06-19 11:57:45,993 WARN c.g.h.IncorrectnessListenerImpl: Obsolete content type encountered: 'text/javascript'.
Some of the previous questions says its due to old JARs, but I have all latest.
1. Is there any way to solve this ?
2. Can we set logLevel in the webdriver sampler ?
No one will be able to provide answer to point 1 unless you provide the URL of the page you're trying to test.
Looking into the warning itself - it indicates a bug in your system under test as valid Content-Type for JavaScript should be application/javascript so you can raise a defect to get this fixed.
If you totally sure that the behavior is expected and there are no plans to fix these "tons of errors" you can add the next line to log4j2.xml file in "bin" folder of your JMeter installation under <Loggers> tag:
<Logger name="com.gargoylesoftware.htmlunit" level="fatal"/>
See How to Configure JMeter Logging article for more information on tuning JMeter logging subsystem.

Jmeter: File upload Issues while Jmeter scripting

I have a scenario wherein I have to upload a .txt file which inserts records in database, for a batch job operation further. I am using Jmeter scripting to automate this flow. I think I have followed all the rules needed to upload a file but still I face this error:
Response code: 500
Response message: Internal Server Error
Here are the details of scripting the file upload
jmeter_fileUpload_1
jmeter_fileUpload_2
and the html code showing the paramter name for the input type "file"
<input type="file" size ="40" name="filename" class="textinputgroup_input" title="Use Browse button to select the file.">
I am not sure where I have made the mistake. I have properly used the request attributes in the HTTP sampler as per the Fiddler.
I will not be able to record due to some firewall restrictions
Your config looks good, just make sure that:
File exists under the ${filepath}
${filepath} should contain either full path to the txt file being uploaded or the file needs to live in JMeter's "bin" folder
In case if it doesn't help, check jmeter.log and/or server-side log file to get some clues regarding what's wrong. It may be something like missing header or whatever. As a last resort try comparing the requests which are being sent by JMeter and real browser with a sniffer tool like Wireshark to detect the differences and apply the appropriate JMeter configuration so requests would be identical.
See Performance testing: Upload and Download Scenarios with Apache JMeter article for more detailed instructions.

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... :-).

Resources