Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How send application/x-www-form-urlencoded params to a RestServer with JMeter?

I developed a rest server, and I put it to run in localhost, and I'm trying to perform tests with JMeter, sending requests posts and gets (depends of called method).

I already send to Rest server and got result with JMeter in simple post requests, get requests, sending files with post, and sending a Json with post.

But I don't know how to send a Form-UrlEncoded object to server. My Rest server consumes application/x-www-form-urlencoded, and I need to send 3 String parameters.

There's some way to set the MimeType for every parameter and perform the test ?

I'm using Jmeter 2.7

  • [Update]

I solved this by disabling the option:

use multipart/form-data for post

And enabling:

redirect automatically

Instead of:

follow redirect

The parameters I put normally in the table "Send parameters with the Request" with each respective names.

like image 367
Raduan Santos Avatar asked Jun 28 '12 18:06

Raduan Santos


2 Answers

Here's the solution for HTTP POST with x-www-form-urlencoded testing with jmeter. You just folllow like these. enter image description here

enter image description here

enter image description here

Go to Thread Group -> Add listener -> Views Result in table, View result Tree. To see the process of responding.

like image 146
Vinh Trieu Avatar answered Sep 19 '22 15:09

Vinh Trieu


For sending form parameters as application/x-www-form-urlencoded, add a header parameter Content-Type with value application/x-www-form-urlencoded.

The following steps is aplicable for Jmeter 2.3.4

  1. Add a HTTP Header Manager under your http Request.
  2. Add new parameter to HTTP Header Manager with name Content-Type and value application/x-www-form-urlencoded.
  3. Uncheck "Use multipart/form-data for HTTP POST" of HTTP request.
  4. Uncheck "Encode?" of each request parameter(not necessary).
  5. kept "Content Encode:" text box of HTTP request as empty.

    This won't work for PUT request. For put request add parameters as path parameter and set Content-Type header then Jmeter will do by itself.

like image 23
Alex Mathew Avatar answered Sep 20 '22 15:09

Alex Mathew