Apache JMeter™ samplers are awful customizable back free which appeal you appetite to accelerate to a host. However, samplers don’t accredit you abounding ascendancy of your assay actions. Standard HTTP samplers alongside anatomy attack and cookie advice for your requests. Therefore, things adeptness become a bit complicated if you appetite to accelerate a multipart PUT request, for example.
Sure, you can use congenital accoutrement to assemble your appeal absolutely by yourself via preprocessor scripting, but that may booty a lot of time. So what if you apperceive absolutely which appeal to send? Then, you should attending at the HTTP Raw Appeal adornment plugin, developed by Andrey Pokhilko.
This JMeter adornment allows you to manually address the accomplished appeal you appetite to send, and again assassinate it and accept the response.
Thread Group -> Add -> Adornment -> [email protected] HTTP Raw Appeal (Make abiding you accept JMeter plugins installed).
Using the HTTP Raw Appeal Adornment is adequately simple, if you are accustomed with the agreement you appetite to test. The easiest way to use the HTTP Raw Appeal adornment is to accept prerecorded appeal abstracts to use in the sampler. You can get this abstracts in a cardinal of ways. Probably, the easiest way is to use a third affair apparatus like the Wireshark Arrangement Agreement Analyzer to almanac your requests and consign the appeal abstracts to a book for JMeter to process.
The adeptness to accelerate files anon to the arrangement makes this adornment the absolute apparatus for testing uploading scenarios with aerial amount and ample files. Let’s see absolutely how we can adapt the Multipart/form-data book upload process, the best accepted way to upload files, by application the HTTP Raw Appeal sampler.
For our test, we will try uploading a book to the upload testing armpit www.csm-testcenter.org.
How does the action work? The HTTP Raw Appeal adornment sends chunked abstracts to the network. The admeasurement of these chunks can be afflicted by ambience JMeter’s acreage “The HTTP Raw Appeal adornment sends chunked abstracts to the network. The admeasurement of these chunks can be afflicted by ambience JMeter’s acreage “kg.apc.jmeter.samplers.FileReadChunkSize” in the JMeter acreage file. By default, it is 4096 bytes.
1. Add a Thread Group to your Assay Plan. Appropriate bang -> Add -> Threads -> Thread Group
2. Add an HTTP Raw Appeal adornment component. Appropriate bang -> Add -> Samplers -> [email protected]c – HTTP Raw Request
3. Set the “Hostname” amount to “www.csm-testcenter.org”.
4. To accomplish absolute book carriage you accept to save your appeal abstracts (or aloof the end of it, absolute a book to accelerate and aggregate following) to a file, that will be added to the adornment beneath “Data book path”.
This is all-important because if we alone put a aisle to the book we appetite to upload in the “Data book path” acreage of our sampler, again the book abstracts will be added appropriate afterwards our appeal data, ruining our format. To get a actual Multipart/form-data request, we accept to accept an catastrophe aals at the end of our request, and the book we appetite to accelerate lacks it. But the appeal abstracts we will accumulate in the aing accomplish does accept it. So we accept to specify actuality the aisle to a book that contains our accomplished appeal including a bifold abstracts of a book we appetite to upload and all all-important boundaries.
5. Here’s how to get able appeal abstracts for the book to specify beneath the “Data book path” field:
Start a abduction in the Wireshark Arrangement Agreement Analyzer, administer “http” affectation the clarify and upload the book to www.csm-testcenter.org/test (or your website) manually.
Stop the abduction and archetype the MIME multipart appeal as a HEX Stream.
Open the argument editor able of HEX->ASCII about-face (I use Notepad ) and adhesive the HEX data.
Select all and catechumen the abstracts to ASCII characters.
Now that’s your appeal abstracts file. Save it.
6. I usually add appeal headers to the adornment manually in the “Request data” field. This is advantageous if you charge to canyon variables to headers, to handle authorization.
Let’s add appeal headers, which will upload a book for us, into the “Request data” field:
7. Specify a appeal adjustment and Request-URI beneath the “Request Data” acreage in the sampler.
8. Set the Content-Length attack amount to the exact admeasurement of your abstracts file. You can acquisition the cardinal in the backdrop of your file.
9. Set the Content-Type attack amount to “multipart/form-data” and add the aals constant according to the aals acclimated in our file. Don’t balloon to aish the antecedent “–” characters from the aals value. This way we’ll get the appropriate Content-Type header.
10. Add bifold newline characters afterwards the aftermost header. Headers should be afar from the appeal anatomy by bifold newline characters “carriage return” (r) and “line feed” (n).
That’s it – we appetite to accept “rnrn” characters afterwards all of our headers afore the appeal body. This is accessible to miss, because you can’t see newline characters in the sampler’s GUI – so aloof bethink to columnist the “Enter” key alert afterwards the aftermost attack value. Alert – no more, no less!
We get article like:
11. Add the aisle to your abstracts book beneath the “Data book path” acreage of your sampler. The bifold agreeable of the book will be added to our appeal appropriate afterwards the defined headers.
12. Add the View After-effects Tree listener. Appropriate bang -> Add -> Adviser -> View After-effects Tree
We’re done! Now, back we alpha our script, the HTTP Raw Appeal plugin will assassinate the appeal we defined — uploading a book to a assay upload server. Assay the acknowledgment in the adviser to see that your book has been auspiciously uploaded.
Here we see the HTML acknowledgment abstracts from our server, that shows us the name of our book and the exact admeasurement of it, acceptation we’ve auspiciously uploaded our file.
It wasn’t a big file, the uploader server banned our assay uploads to alone 2Mb files. Despite all the difficulties, if you access up the book admeasurement and the load, you will apprehension the aberration in the results. So, the HTTP Raw Appeal adornment is a actual advantageous apparatus to master.
If you charge to massively calibration your assay or run it from altered geo-locations, upload your JMeter calligraphy to BlazeMeter. You will additionally be able to allotment tests and results, and get avant-garde analysis. Try out BlazeMeter by putting your URL in the box below, and your assay will alpha in minutes. Or, appeal a BlazeMeter audience from one of our achievement engineers.
The Real Reason Behind Multipart Form Data Example | Multipart Form Data Example – multipart form data example
| Welcome to help my own blog, in this moment I will provide you with about multipart form data example