Finished my performance test and need to make visible those test reports in my JIRA cases. Is there any efficient way to verify my JMeter test results in JIRA ?
Please add some screenshots for my reference if there is any methods to be followed to achieve this requirement.
Thanks in advance
As far as I'm aware JIRA has a set of REST APIs and looking into How to add an attachment to a JIRA issue using REST API article you should be able to upload JMeter test result into JIRA using the following command:
curl -D- -u {username}:{password} -X POST -H "X-Atlassian-Token: nocheck" -F "file=#{path/to/file}" http://{base-url}/rest/api/2/issue/{issue-key}/attachments
You can upload results file even from JMeter test itself, i.e.
Add the next line to user.properties file
jmeter.save.saveservice.autoflush=true
Add tearDown Thread Group to your Test Plan
Add HTTP Authorization Manager to the tear Down Thread Group and put your JIRA credentials there
Add HTTP Header Manager and configure it to send X-Atlassian-Token header with the value of nocheck
Add HTTP Request sampler and configure it as follows:
Protocol: your JIRA installation protocol, most likely https
Host: your JIRA installation IP address or hostname
Method: POST
Path: /rest/api/2/issue/issue-key/attachments
Tick Use multipart/form-data for POST box
In the "File Upload" tab provide full or relative path to your .jtl results file and its MIME type. Keep "Parameter Name" value as file
See Performance Testing: Upload and Download Scenarios with Apache JMeter article for more information on performing file uploads using JMeter.
Related
Context: Trying to upload a file to a web application
Let's assume I'm only using the basic options:
HTTP Request Sampler:
Method: Post
Protocol: http
Path: /api/file/upload
Follow Redirects: checked
Use Keep-Alive: checked
Use multipart/form-data: checked
Files Upload:
File Path: C:\Users\etc...etc
Parameter Name: file
MIME: image/jpeg
Cookies are set with Cookie Manager, Login is also set.
Uploading small files (130KB) works fine like this, Bigger files throw an error 500: "Cannot delete temporary file chunk."
On-website upload works fine and uses resumable.js (which is also the one throwing this error I assume)
I am assuming this is due to chunking, since that's basically the only major difference between what I have tried. Does anyone have any insight on this?
Edit: Using the image photoGood that is "chunked"/split in 2 blocks I can also form POSTs with these parameters:
resumableIdentifier 20702285-photoGoodjpg
resumableFilename photoGood.jpg
resumableType image/jpeg
resumableRelativePath photoGood.jpg
resumableChunkSize 1048576
resumableChunkNumber 1
resumableTotalChunks 2
resumableTotalSize 1859876
resumableChunkSize 887520
However, only the ChunkNumber 1 will be used, as in, the chunks are not joined together on the server.
I think your request is missing some mandatory parameters like:
resumableChunkNumber
resumableChunkSize
resumableTotalSize
resumableIdentifier
resumableFilename
resumableRelativePath
etc.
Check out documentation at http://www.resumablejs.com/ website for more details.
If you're able to successfully perform upload using browser you should be able to record the associated request(s) using JMeter's HTTP(S) Test Script Recorder, just make sure to copy your PDF file to "bin" folder of your JMeter installation before uploading the file and JMeter will generate the relevant HTTP Request sampler(s) under the Recording Controller.
Check out Recording File Uploads with JMeter article for more details.
It would also be good to capture the traffic from JMeter and the real browser using a 3rd-party sniffer tool like Fiddler or Wireshark, this way you will be able to identify the differences. Once you configure JMeter to send the same requests as the real browser - the whole transaction will be successful.
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
I need to create a performance test for Nuget repository using Jmeter tool and I need to deploy/upload .nupkg files to the repository however I have a problem with uploading. I receive error number 415 - Unsupported media type. Seems like something wrong with a Content-Type or with multipart/form-data transmission which has to be used for upload. The Jmeter has such option for POST but I have PUT in my case.
The curl below publishes properly
curl -XPUT http://hostname/api/nuget/nuget/ -u login:password -F "package=#/home/nugetFiles/shay-1-test.2.1.0.nupkg"
I have unsuccessfully tried the following - added file path in the Files Upload tab in the HTTP request sampler, added HTTP Header Manager as a child and tried the upload uing several variants with different Content-Types via HTTP Header Manager item.
application/x-nupkg;
application/octet-stream;
multipart/form-data; boundary="6aec860d-8c85-4cea-854e-a051e77873c4";
and Content-Disposition value
Content-Disposition: form-data; name=package; filename=package.nupkg; filename*=utf-8''package.nupkg
HTTP header manager also has X-NuGet-ApiKey value
I also found out that the file should be added to the request body however I do not know how to do it.
Please help.
Just record your upload request.
Copy shay-1-test.2.1.0.nupkg to "bin" folder of your JMeter installation
Configure JMeter for recording. The easiest way is using JMeter Templates feature
from JMeter's main menu choose File -> Templates -> Recording and click "Create"
Open HTTP(S) Test Script Recorder and click "Start"
Execute your CURL request through JMeter's proxu like:
curl -x http://localhost:8888 -XPUT http://hostname/api/nuget/nuget/ -u login:password -F "package=#/home/nugetFiles/shay-1-test.2.1.0.nupkg"
That should be it, the recorded request will live under Thread Group -> Recording Controller.
The root cause it the following - I'm using Jmeter 3.3, the latest released version is 4.0. According to this bug multipart/form-data transmission which is necessary for NuGet client - does not work in Jmeter for PUT method.
I have checked a stable trunk Jmeter version (apache-jmeter-r1831500.zip) has taken from here and was able to deploy Nuget package.
As a workaround it's possible to create a test via OS Process Sampler using bash commands.
Thanks everybody for help.
Test 'download a file using Jmeter': On the web page, there is a button 'download' and clicking it downloads the file with .zip extension. When observed under Network tab of Developer tool (F12)>there are two requests: 1 is the application request which gives the response with link (aws-S3...) (if i copy paste this link, can download the zip file) and 2nd request shows the aws-S3..link. When need to perform this download performance testing with 100 users, how to configure in Jmeter. Please guide. below thing have been tried:
Record a script>it records the first request (not the 2nd request of network tab as mentioned above)
When run the script> this shows 200 code with response message as aws-S3..link
Tried Save response to file listener> nothing has been downloaded.
Extract the download link from 1st response using i.e. Regular Expression Extractor
Add put the JMeter Variable generated by the Regular Expression Extractor into "Path" input of the HTTP Request 2
Add Save Responses to a file listener as a child of the HTTP Request 2
See Performance Testing: Upload and Download Scenarios with Apache JMeter article for more information on simulating file upload/download events in JMeter web tests.
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