how to upload file zip through restful api in jmeter - java

EDIT: how to upload file zip through restful api in jmeterstrong text
I have upload Zip file but result show failure message
{"result":"failure","message":"File not found"}
i have used Mime type:application/octet-stream
but I have run through **fiddler** it show
{"result":"success","message":"File saved successfully"}
please can any one find the sloutions for it
what can do for jmeter

I don't see any Parameter name in your HTTP Request. Put a parameter name in your Request.
The Parameter name must be carefully specified. Otherwise, your file will be going nowhere. In order to determine the correct value do one of the following:
Inspect page source and get “name” attribute of “file” type input.
Or let JMeter do it for you via the HTTP(S) Test Script Recorder.
Reference: Performance testing: Upload and Download Scenarios with Apache JMeter.
You may also find these useful:
Handling File Upload in JMeter
Testing advanced REST API File Uploads JMeter

Related

Export Salesforce Reports as CSV (Java)

I'm trying to automatise the exporting of Salesforce Reports as CSV's, so far I've managed to authenticate in the Salesforce API but I couldn't find any proper documentation on how to export the Salesforce Reports as CSV's or any other examples of doing it.
I've understood that there is a chance that could not be done, but you can still export it as a JSON and convert it to a CSV using a library, although I didn't find anything.
If you're authenticated (got session id back) you're almost there.
The hacky, not officially supported way is to send a GET request to the report export just like user would click a button. Check out How to download a report as a CSV directly from Salesforce Lightning? or Salesforce: Download Reports via URL in R examples (it's not Java but same principle). You'd have to send header that sets cookie with sid=sesionidgoeshere.
The more official way would be to use the reporting API

How to upload file in a JSF application using JMeter

I've been asked this time to also create a test script for file upload in a JSF application using JMeter. The generated script from blazemeter is as follows:
generated script for input form
The encircled value is the file name. I have noticed that the parameter was not created under "Files Upload" tab, so I have also tried to move the parameter to File Upload tab, using the generated content type in our application logs when uploading as Mime Type in JMeter:
Jmeter file upload tab
Generated content type
But it has the same result when I first tried the script where the file name parameter was still under "Parameters" tab (file name is null according to localhost application logs):
Application log indicating that file name is null
The UI of the file upload is this. The user clicks browse button, picks a file then the name of the file is displayed in the input field (Import File). The user would then click the Import button to submit the form:
File upload UI
Am I missing a step or doing something incorrectly?
Thank you in advance! Any help would be greatly appreciated.
Your way of building a file upload request might be wrong, if you want to continue manual experiments I would recommend comparing requests which are being sent by JMeter and the real browser using a sniffer tool like Wireshark. Apart from ${VIEWSTATE} the requests should be exactly the same.
An easier option would be just re-recording the request (you can record only one single request) using HTTP(S) Test Script Recorder.
Prepare JMeter for recording. The easiest way of doing this is using JMeter Templates feature
from JMeter main menu choose File -> Templates -> Recording and click "Create"
expand HTTP(S) Test Script Recorder and click "Start"
Prepare your browser for recording, refer your browser documentation in order to set up proxy using localhost as the proxy host and 8888 as the proxy port, the proxy needs to be set for all protocols with no exclusions. The relevant configuration for Mozilla Firefox (the only free and open source popular browser, moreover it has separate proxy configuration which does not derive from the operating system) would be:
Copy the file you will be recording to the "bin" folder of your JMeter installation. If you omit this step JMeter will not be able to properly record the request. See Recording File Uploads with JMeter article for more details if needed
Execute the request in browser - the relevant HTTP Request sampler will be generated under the Recording Controller

How to save/open files on server with GWT

I have a BIRT report that I've created in GWT and I'd like to save it to the server and then open it back up. I feel like hardcoding the url is the wrong route to go (ie C:/files/foo/foo.html) but I'm not having much luck figuring out another way of doing it. I tried using GWT.getModuleBaseForStaticFiles() but if i use that I get an unsatisfied link error in BIRT. What can I use to save/open a file, what is considered the best practice? Thanks.
edit: bad wording, the BIRT report is generated server-side. I'd like to be able to save it server side and then open it up in a new browser window (using window.open I'd imagine?). Nothing is uploaded from the client side.
If your BIRT report is a static file (Not generated during the runtime of your application) You can create a simple Servlet that read the file and copy the data to the OutputStream of the response. If it's generated at the runtime, the client will request it to the server, the server will generate it and return the URL location of the report. The client can open the report with that URL.
Example:
If your BIRT is located under foo/foo.bar you can map a servlet as /foo/*. After mapping it the user will request the url www.yourselver.com/foo/foo.bar The servlet at the doGet method can read the file and stream the content back to the client.

java - checking file content before uploading to server

i have got a situation now.
I need to develop a webpage where user can select a file to upload and before uploading the file to server i need to check first few lines of the file whether the data is valid or not and if the data is valid then upload the file, if not through an error message.
the file will be text file.
thanks,
Sandeep
HTML/Javascript does not offer a way of reading the contents of a local file. You must either upload it and check it in the server.
If you really want a client side check, you then must build a signed applet(or even ActiveX) to run in your webpage and handle the upload instead of using plain HTML.
You should perform your validation on the server side, right before you perform the upload.

Get FileModification/Creation time of a file on a webserver

Howdy,
I'm currentyl new to Java and Android but I would like to write an App which checks a webserver on a particular file. If that file is NEWER than the locally saved file it should go ahead and download the file.
Now I've already got the download in place .. but I don't know how I can check the file on the webserver. Any help would be appreciated! :)
Look into sending your request with an If-Modified-Since header. This makes your request conditional based on the resource you are requesting. If it hasn't been updated since that time, it will return a 304.
See Section 14.25 of this page for more details.

Categories

Resources