File upload in Moodle using jmeter - file

I'm busy setting up a load test for file upload in moodle and I am struggling with the file upload. It seems to be losing the sesskey when it gets to the uploading of the file.
Here is the error message from the response data:
"{"error":"A required parameter (sesskey) was missing","errorcode":"missingparam","stacktrace":null,"debuginfo":null,"reproductionlink":null}".
Please help, this test needs to be done in the next 2 days.
Thank you in advance.
I extracted the sesskey using the Regular Expression Extractor and this worked for downloading a file and taking a quiz in moodle but for file upload it loses the session.

Just record the file upload event using HTTP(S) Test Script Recorder, the only thing you will need to do is to copy the file(s) you will be uploading to "bin" folder of your JMeter installation prior to starting the file upload in the browser, this way JMeter will be able to properly capture the request and generate the relevant HTTP Request sampler and HTTP Header Manager
See Recording File Uploads with JMeter article for more details.
Once you have recorded "skeleton" you can correlate the dynamic values like sesskey

Related

Streaming the zip file to the calling application using Vert.x

One Gateway application is going to send a GET request to my Vert.x application. For this request, I need to read a large zip file from Amazon S3 server which I am able to read in BufferedInputStream. I don't want to download this file but rather I need to send this stream data to the gateway application (NOT a downloadable file with application/zip content type but stream data or byte chunks) which it will further send to end application where this stream data will be downloaded as a zip file. So the sending the zip file in form of stream to the gateway application I need to achieve using Vert.x. Already gone through lot of documentation and blogs but everywhere it is given to download the zip file which is not my intention. Could anyone please suggest how I could achieve this streaming of zip file in http response of calling request using Vert.x? Do I need to use Java NIO? If yes, could you please put details? Sorry, but I have nothing to put here as part of code. Thanks in advance!

How to create folders and images using AngularJS

I have an AngularJS app that, upon requested to upload an image, creates a folder inside the file system (CentOS) and then puts that image there, telling the user everything went OK or not.
Is this possible? All I've found is ways to download the file.
Thanks.
It is better to delegate this task to a service on the server, since it is file that is uploading to a server. I put simple rest service to file upload this file to the server.

Upload file is not working using AngularJS on lighttpd server

In my current project we are using lighttpd server. Here I am trying to upload the file. I am getting two Response Headers, first is with 301 Status code (Moved Permanently) and second is with 200 (OK).
But when I am checking in the folder I am not able to find any file (I mean no file uploaded).
I have tried both way to upload file as given links below:
http://jsfiddle.net/danialfarid/0mz6ff9o/135/
ngFileUpload
https://jsfiddle.net/JeJenny/ZG9re/
In both way I am getting the same response.
So here I have some sort of questions:
1) Is file upload is possible using AngularJS only? (No Server Side Script)
2) If possible, Is there any config problem with lighttpd?
Thanks !
Need Help...
The server side (or any web server) must be configured to handle POST and PUT requests. CGI, FastCGI, SCGI scripts can be written, or you can proxy to another backend. For simple file uploads, lighttpd also provides mod_webdav which you can configure (and protect with mod_auth) to allow you to upload files without having to write any server-side code.
https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModWebdav

How to upload file in Front End using Jmeter?

I am trying to upload a file using jmeter on the front end. There are three files that are need to be uploaded and then the Submit button will be enabled. Is there any way to it through jmeter?
I am able to do it from the back end. But i want to use the URL of the website through Jmeter in order to do performance testing of the website.
As per very main page of the Apache JMeter project:
JMeter is not a browser.
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 viewed at a time).
So JMeter won't check the status of the "Submit" button, it acts on protocol level and will send the corresponding request in any case.
In regards to the File Upload bit itself. You can do it with HTTP Request sampler, just make sure:
You use POST (in some cases it can be PUT) method
Use multipart/form-data for POST box is checked
In Files Upload section the following values are provided:
File Path (either absolute or relative to JMeter's "bin" folder)
Parameter Name (form name which contains <input type="file" ... tag, you can figure that out from upload page source code)
File MIME Type
Actually the easiest way to build a file upload request is just recording it, see Recording File Uploads with JMeter guide for more details.
Steps to perform:
Add HTTP Request in TestPlan
Select the post/put method
Type in the PATH
Select use multipart/form-data
Under the File Upload tab, enter the file path, Parameter Name, and MimeType.
MIME Type examples: image/jpeg, image/png, text/plain
Save and run the test.
Screenshot below:

AppEngine Bulk upload along with files

I need to do bulk upload data from CSV file to Datastore. Although the data in the CSV file is also having a field which should be URL to a file.
Each row(person) is mapped to an associated file. which either i can upload in Google Cloud Storage. Although at runtime how can i upload the file and then get the URL and update the CSV file. Then use the CSV file to do Bulk upload.
Need to have a solution for this.
THanks for Help
Two ways of doing this
Write stuff in your request handler and perform the task, raw data can be uploaded to gae as a project resources, there are some size limits obviously
The better way is to enable remote api , then use remote api python script to batch upload stuff or write some code in python which points to your remote datasource.

Resources