如何使用JMeter将application/x-www-form-urlencoded参数发送到RestServer? [英] How send application/x-www-form-urlencoded params to a RestServer with JMeter?

查看:740
本文介绍了如何使用JMeter将application/x-www-form-urlencoded参数发送到RestServer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个休息服务器,并将其运行在localhost中,并且尝试使用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).

我已经发送到Rest服务器,并通过简单的帖子请求与JMeter取得结果,获取请求,使用帖子发送文件,以及使用帖子发送Json.

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.

但是我不知道如何将Form-UrlEncoded对象发送到服务器.我的Rest服务器消耗application/x-www-form-urlencoded,我需要发送3个String参数.

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.

有一些方法可以为每个参数设置MimeType并执行测试?

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

我正在使用Jmeter 2.7

I'm using Jmeter 2.7

  • [更新]

我通过禁用此选项解决了此问题:

I solved this by disabling the option:

use multipart/form-data for post

并启用:

redirect automatically

代替:

follow redirect

我通常在参数随请求一起发送参数"表中分别输入每个参数的名称.

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

推荐答案

您是否尝试过使用 BadBoy来保存测试 JMeter代理来查看您的应用程序实际发送了什么?

Have you tried to save your test using BadBoy or JMeter Proxy to see what your application actually sends?

要查看幕后情况,如果使用FireFox,也可以使用FireBug,如果使用的是Chrome,则可以使用Ctrl+Shift+i.

To see what happens under the hood you can also use FireBug if you're using FireFox or Ctrl+Shift+i if you're on Chrome.

这篇关于如何使用JMeter将application/x-www-form-urlencoded参数发送到RestServer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆