JMeter embedded resources being downloaded when disabled - jmeter

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.

Related

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

handling dynamic pop-up error message in jmeter

I have a Jmeter script for an application for which i get pop up error message intermittently. Where as in jmeter we only come to know that flow got terminated by some failure.But we wont come to know the occurrence of Error pop -up message.
My requirement is if we encounter pop up error i want to write to an external file saying that ,the current page got failed due to pop-up error message.
If we can write the error message it's really great. I'm as of now not getting idea to achieve this.
Please can anyone help me in this. or can provide any hint to do R&D.
Thankyou in advance.
Updated the question with screen shot of error message.
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).
Looking into your screenshot, it is a form of JavaScript popup, most likely window.alert so there is no way to detect it via JMeter.
You can add i.e. Response Assertion to your test in order to introduce some pass/fail criteria, i.e. if you were in the middle of some transaction when the error occurred it should not finish successfully resulting in missing expected entry in the web page (or database), so you can conditionally fail relevant sampler(s) in this case. See How to Use JMeter Assertions in Three Easy Steps to learn more about the concept.
Alternatively you can use WebDriver Sampler plugin which provides JMeter integration with Selenium browser automation framework which drives a real browser, so you will be able to capture this popups and record the page titles/take screenshots, check out IsAlertPresent() class for more information.
you must get this error response in your jmeter request response.simple answer.Have a regex to extract.

Data entry through Jmeter not reflected in UI of application

I'm using Jmeter to perform load test on Moodle application
I followed the below steps to replicate a simple "add company " test scenario
1: Recorded the browser actions through HTTP Test script recorder and created a test plan with thread user of 1
2: Added HTTP Cache Manager,Added regular expression extractor for retrieving dynamically generated session for login HTTP request.
For Http request of adding new company, addded user parameters containing new company name
I run the test, everything seems ok in the view results tree- response section (response code: 200,response message:OK), all the required variables are passed in the HTTP POST
PROBLEM: New company added through Jmeter test is not reflected in UI of the moodle action
Can any of you please let me know
Is there something I could be missing or anyway I can debug the problem?
P.S: I'm new to Jmeter and looked around a lot for data inputted through Jmeter not being displayed in the UI of the web application,dint find useful results.
The answer to questions of this sort is almost always that you missed some necessary dynamic value besides session ID which you did catch.
An HTTP200 response just means the server returned a "good" response. Which could also happily contain an error message.
I would check the actual html body of the returned response for any errors. Checking the log on the server side can give you clues to what went wrong sometimes. You should also try adding a cookie manager.
Run your test with 1 virtual user in GUI mode with View Results Tree listener enabled and inspect responses to see where your scripts fails. My expectation is that you simply cannot log in.
See Moodle-JMeter-LoadTest.jmx file for reference, it uses XPath Extractor to get session key and course id.
I don't think you can test using JMeter. Try JUnit Test cases instead http://jakarta.apache.org/jmeter/usermanual/junitsampler_tutorial.pdf

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