2015-01-16 13 views
0

每一次当我的JMeter记录,我有一个请求,编码的项目如下需要生成编码的请求从的JMeter

cGFyYW1ldGVyX3ZhbHVlPTEyMyZyZWd1bGFyX2V4cHJlc3Npb25fdmFsdWU9NDU2JmlzX3BvcF91cD1ZJmhlYWRlcl90eXBlPWFkdl9wb3BfdXA= 

然后我解码发现如下

parameter_value=123&regular_expression_value=456&is_pop_up=Y& 
header_type=adv_pop_up 

凡为123参数值(即输入值)和456是正则表达式值。

如何传递这两个值并编码请求并从jmeter发送?

+0

捕获这些值并使用正则表达式提取,然后将它传递给下一个请求 –

+0

问题不在于解压缩,如何通过这些值来编码和发送来自jmeter的请求 – user3559336

+0

您应该仔细看看Jmeter采样器选项(您还没有它似乎)。如果它的标准编码,那么Jmeter采样器有复选框(编码复选框),如果它是自定义编码,那么你可以使用java代码或beanshell处理器来实现它。 –

回答

0

它是Base64编码。即如果你想编码并发送以下请求行:

PARAMETER_VALUE = & regular_expression_value = 酒吧 & is_pop_up = Y & header_type = adv_pop_up

可以使用__Beanshell()功能

${__BeanShell(import org.apache.jmeter.protocol.http.util.Base64Encoder; Base64Encoder.encode("parameter_value=foo&regular_expression_value=bar&is_pop_up=Y&header_type=adv_pop_up");)} 

foobar也可以是JMeter的变量

${__BeanShell(import org.apache.jmeter.protocol.http.util.Base64Encoder; Base64Encoder.encode("parameter_value=${foo}&regular_expression_value=${bar}&is_pop_up=Y&header_type=adv_pop_up");)} 

How to use BeanShell: JMeter's favorite built-in component指南来了解更多关于BeanShell中的力量。

如果此功能行似乎可怕,您可以考虑使用JMeter PluginsStandard Set有两个功能可以帮助您进行Base64编码和解码。它们是:

  • base64Encode
  • base64Decode

JMeter Plugins Custom Functions文档了解更多信息。