unable to upload file using jmeter - jmeter

i have recorded uploading and downloading file scenario in my work, am able to login and downloading file successfully but am facing the issue with uploading a file(Jmeter) also am able to uploading Folder but am not able to upload file into the application, while recording time it self am unable to upload PDF and Word document only text document uploading but it is uploading manually. can you please help me on this.
Thanks!

You need to copy the file, you're uploading into JMeter's "bin" folder, this way HTTP(S) Test Script Recorder will be able to capture the call and convert it into the relevant HTTP Request sampler. See Recording File Uploads with JMeter for more details.
If you're building the request manually consider the following points:
Either use full path to file, you're uploading, or copy it to JMeter's "bin" folder
Don't forget to tick Use multipart/form-data for HTTP POST box
Make sure you provide correct Parameter name and MIME Type

Related

JMeter - Issues with Image Upload for API Request. Recording doesn't work

If I upload an image on Postman using only binary option it works. If I use form-data to upload a file on Postman the image file gets corrupted with unnecessary appended info. So I tried to record JMeter script while uploading image on Postman using binary option. But the image size grew from 279kb to 509kb and I got a corrupt image. It's only 279kb when I send on Postman without recording. See pictures below.
If I use the "Files Upload" tab on JMeter HTTP Request, it appends info as below making the image file corrupt. The JAVA implementation on Advanced tab doesn't work either.
--WNAkrdOzMmE0iZxPNbdHVVPxuBwgUX
Content-Disposition: form-data; name="source"; filename="fileupload.jpg"
Content-Type: image/jpeg
Can someone please provide me Groovy or BeanShell code to upload multiple image files one by one? Or, if there is a way to capture the traffic properly without the image file getting corrupt with additional data, please let me know and I can try. Thanks.
binary file upload means that the file is being send as the HTTP Post request body
JMeter's equivalent configuration would be:
Switch to the Files Upload tab of the HTTP Request sampler
Provide full or relative path to the file you want to upload
Other fields should remain intact
More information: JMeter Performance Testing: Upload and Download Scenarios

Uploaded xml file content is not showing in the request body in Jmeter and the request fails

Uploaded xml file content is not showing in the request body in Jmeter.
Jmeter version: 5.4.1
We have .xml file upload scenario, recorded using Blazemeter. After downloading the recorded script to Jmeter, necessary token co-relation and extracting required values using RegEx been done. Then tried to run the script, it fails at the upload request.
Recorded script doesn't have "FileUpload" tab with location. I updated with the file location too. As suggested in other queries/blogs, observed the traffic using other tools to see if any header value is missing and incorporated that too still it fails at upload request.
Observed that, the request body shows file content in other tools where as in Jmeter the file content is not shown.
ZAP tool request body:
Jmeter:
Also, the headers shows in green color, not sure if any specific reason to look at it under view results tree - http request.
Try re-recording the request (it may be a single request only, enable proxy just for it) using JMeter's HTTP(S) Test Script Recorder, it should generate the HTTP Request sampler with "Files upload" section and Use multipart/form-data for POST box checked.
Just make sure to copy the XML file(s) you're uploading to "bin" folder of your JMeter installation prior to uploading the file, this way JMeter will be able to properly "catch" the request.
More information: Recording File Uploads with JMeter

Tar.gz files are not extarcting in Google cloud bucket using Jmeter

I am trying to upload tar.gz files into google cloud bucket using jmeter. Here i am using File management service, GCS & Jmeter.
Execution flow.
1. Using get Request i am hitting FMS.In response I'll get response message. this response contains the URL to upload the file to GCS.
2. Now the file SJ311.tar.gz file is uploaded in the folder iviu/SJ311 folder in GCS.
3. In GCS cloud function is written a code which will extract the .gz file & all .csv files should be extracted successfully.
Issue : through POSTMAN i am able to do this i.e. file is uploaded & it is decompressing the tar file but using jmeter file is uploaded successfully but its not extracting/decompressing.
If you're able to send the request using Postman and see that JMeter behaves differently than it means that you're not sending the same request using JMeter.
Most probably this is due to missing or incorrectly defined HTTP Header so make sure to compare each and every detail of the request and given you send the same requests you should get the same behaviour/response.
Going forward if something is working in Postman and not working in JMeter you can just record the relevant request using JMeter's HTTP(S) Test Script Recorder, just configure Postman to use JMeter as the proxy and run your request, JMeter will capture it and properly build the HTTP Request sampler, add HTTP Header Manager, etc.
Just remember to copy the file(s) you will be uploading to the "bin" folder of your JMeter installation prior to recording, otherwise JMeter will not be able to capture the request.
Solution to the above question is, under File upload section-> under Parameter name field i added DOM attribute or webelement value for the "upload file" button which is present in Google cloud storage screen.
Now after removing that parameter value, file is getting uploaded successfully.
If we add the attribute value, file will get uploaded successfully but it will be corrupted.

how to send the file with Http request in jmeter

Please find the below post data for the request to send the file to application,I have tried but not uploading the file to application and even I couldn't see any error for that request in jmeter,Please hel me.
{"requests":[{"event":[{"controller_id":"${codDocID}","event":"AddFileMDSubmit","id":"createFile","param":[{"name":"Path","value":"/Root/AttachmentFolder"},{"name":"Action","value":"CreateFile"}]}],"data":[{"scope":[{"path":"/Root","changed":""},{"path":"/Root/EnableDisableActionMenu","changed":""},{"path":"/Root/$System","changed":""},{"path":"/Root/$ThingHeader","changed":""},{"path":"/Root/UIState","changed":""},{"path":"/Root/ZSchdleDateTime_200486e20a2d29145d81bba1f204e795","changed":""},{"path":"/Root/zFeederRelevant","changed":""},{"path":"/Root/$UISwitch","changed":""},{"path":"/Root/ToCoreBO","changed":""},{"path":"/Root/LaunchPreviewPDFStruct","changed":""},{"path":"/Root/ScopingIndicator","changed":""},{"path":"/Root/HybrisIntegration","changed":""},{"path":"/Root/UtilitiesIndExt","changed":""},{"path":"/Root/TP_ResolutionDueDateTime/content","changed":""},{"path":"/Root/TP_ResolutionDueDateTime","changed":""},{"path":"/Root/TP_CompletionDue/content","changed":""},{"path":"/Root/TP_CompletionDue","changed":""},{"path":"/Root/ExternalSalesOrderDocumentReference","changed":""},{"path":"/Root/EmailFeeder/InteractionAttachments","changed":"","columns":[{"path":"SelectedIndicator","changed":"X"},{"path":"NodeID","changed":"X"}]},{"path":"/Root/Customer_BusinessPartner/Structure","changed":""},{"path":"/Root/Customer_BusinessPartner","changed":""},{"path":"/Root/PricingTerms","changed":""},{"path":"/Root/CpTotalCustAmount_0479727343a243b5b39e3b8dd38054aa","changed":""},{"path":"/Root/CpTotalReclAmount_bff3d7be2aec457786179c6bc6f0e83b","changed":""},{"path":"/Root/CpTotalReclUponRet_55e401c0e848418fb07a3b71c480125e","changed":""},{"path":"/Root/CpTotalCustInDest_ebcecb07263e4d81b8ad6a2105b4ce16","changed":""},{"path":"/Root/CpTotalReclInDest_73eb1b917ee34f2db12f1d491d0e642e","changed":""},{"path":"/Root/CpTotalCustUponRet_4d69521c51ac4e7b96601ad2402a599e","changed":""},{"path":"/Root/ZK_ApprovedAmount_75f8a8768f4708ab080050e720617a13","changed":""},{"path":"/Root/CreatedOn","changed":""},{"path":"/Root/ChangedOn","changed":""},{"path":"/Root/TP_InitialReceipt/content","changed":""},{"path":"/Root/TP_InitialReceipt","changed":""},{"path":"/Root/TP_InitialResponseDue/content","changed":""},{"path":"/Root/TP_InitialResponseDue","changed":""},{"path":"/Root/TP_InitialResponse/content","changed":""},{"path":"/Root/TP_InitialResponse","changed":""},{"path":"/Root/TP_Completion/content","changed":""},{"path":"/Root/TP_Completion","changed":""},{"path":"/Root/TP_ResponseByProcessorDue/content","changed":""},{"path":"/Root/TP_ResponseByProcessorDue","changed":""},{"path":"/Root/CpApprovalAchievedDateTime_e5a9db72014e12473aa7b19f1b100ecc","changed":""},{"path":"/Root/SearchResults","changed":"","columns":[{"path":"Index","changed":"X"},{"path":"ArticleIcon","changed":"X"},{"path":"ExternalKnowledgeBaseArticleURI","changed":"X"},{"path":"ExternalKnowledgeBaseCode","changed":"X"},{"path":"ExternalKnowledgeBaseArticleID","changed":"X"},{"path":"Author","changed":"X"},{"path":"Date","changed":"X"},{"path":"ExternalKnowledgeBaseArticleDescription","changed":"X"},{"path":"ExternalKnowledgeBaseArticleDescription1","changed":"X"},{"path":"ExternalKnowledgeBaseArticleShortURI","changed":"X"},{"path":"ExternalKnowledgeBaseArticleURI1","changed":"X"},{"path":"JAMUri","changed":"X"},{"path":"JAMViewsCount","changed":"X"},{"path":"NodeID","changed":"X"},{"path":"Note","changed":"X"}]},{"path":"/Root/From_KB_EC/DetailView","changed":""},{"path":"/Root/From_KB_EC","changed":""},{"path":"/Root/SimilarTickets","changed":"","columns":[{"path":"Index","changed":"X"},{"path":"Name","changed":"X"},{"path":"ID","changed":"X"},{"path":"UUID","changed":"X"},{"path":"#RowCount","changed":"X"},{"path":"CustomerFormattedName","changed":"X"},{"path":"ReporterName","changed":"X"},{"path":"ServiceRequestUserLifeCycleStatusCode","changed":"X"},{"path":"CreationDateTime","changed":"X"},{"path":"ProductID","changed":"X"}]},{"path":"/Root/SimilarTicket_UIData","changed":""},{"path":"/Root/TimeEntry_MergeTimeItem","changed":""},{"path":"/Root/ChildServiceRequstModificationUserSelected","changed":""},{"path":"/Root/TP_ResolvedOnDateTime","changed":""},{"path":"/Root/TP_OnSiteArrivalDateTime","changed":""},{"path":"/Root/TP_OnSiteArrivalDueDateTime","changed":""},{"path":"/Root/TP_RequestedFulfillmentEndDateTime","changed":""},{"path":"/Root/TP_RequestedFulfillmentStartDateTime","changed":""},{"path":"/Root/TP_Escalation","changed":""},{"path":"/Root/TP_ResponseByCustomer","changed":""},{"path":"/Root/TP_ResponseByProcessor","changed":""},{"path":"/Root/WarrantyReferenceDateTime","changed":""},{"path":"/Root/StickyNoteInteractor","changed":""},{"path":"/Root/PricingTerms/DateTime","changed":""},{"path":"/Root/Groups_Recommended","changed":""},{"path":"/Root/LoggedUserDetails","changed":""},{"path":"/Root/zAWS_Features","changed":""}],"id":"${codSeodAgentID}"},{"id":"${codDocID}","flat_data":[{"key_path":"/Root/AttachmentFolder/AddParams/TypeCode","value":"${typeCodeVal}","aspect":"C"},{"key_path":"/Root/AttachmentFolder/OutputRelevant","value":"","aspect":"C"},{"key_path":"/Root/AttachmentFolder/AddParams/fileName","value":"${fileName}","aspect":"C"},{"key_path":"/Root/AttachmentFolder/AddParams/Title","value":"${fileName}","aspect":"C"},{"key_path":"/Root/AttachmentFolder/AddParams/fileSize","value":"190","aspect":"C"},{"key_path":"/Root/AttachmentFolder/AddParams/content","value":"id%3D00163E2F045E1EE88BD561E26708DE0E","aspect":"C"}]}]}]}
Store your file in "bin" folder of your JMeter installation as i.e. data.json
Switch to "File Upload" tab of the HTTP Request sampler and configure it like:
If you're uncertain regarding what to put in the "Parameter Name" field you can just record your request using JMeter's HTTP(S) Test Script Recorder via web browser, just make sure that the data.json file is present in JMeter's "bin" folder. Check out Recording File Uploads with JMeter guide for more details.

How can we measure the performance of downloading file activity using Jmeter

Steps:
Login into application
Dashboard page will be loaded
Click on the "User Details" section
Select the file and click on the download button.
Windows POP-UP will prompt and will ask to SAVE the file.
File will start to download on to specified location
Downloading the file is nothing more than HTTP GET method, so given your configure HTTP Request sampler URL to point to the file you want to download:
JMeter will download the file when you run the test and measure the associated time.
You can also use Save Responses to a file listener if you are interested in the remote file content of plan to reuse the downloaded file later on.
More information: Performance Testing: Upload and Download Scenarios with Apache JMeter

Resources