如何在JMeter中使用Extractor Regex?

时间:2016-01-11 15:02:10

标签: asp.net regex testing jmeter performance-testing

如何从以下响应的标题中提取“位置”的参数?

HTTP/1.1 301 Moved Permanently
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Content-Encoding: gzip
Expires: Mon, 11 Jan 2016 13:41:03 GMT
Last-Modified: Mon, 11 Jan 2016 13:41:03 GMT
Location: hffffer.aspx?GcgvR25kUEPovjjFC8Tv6TErQhGyPEV/aCtmW0wQB76YRC5ShAy/e624URjHnt65zVa8eQCkiOPyB3zIzcKbBhVKSJabVf8z3uqAVKO7tdl8cbHjSQ+/dsTKgxXiuw0B12fhOvPj/pVURdGivisByA==
Server: Microsoft-IIS/8.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 11 Jan 2016 13:41:03 GMT
Content-Length: 0

1 个答案:

答案 0 :(得分:1)

使用以下正则表达式提取器配置:

  • 要检查的字段:Response Headers
  • 参考名称:任何有意义的内容,即location
  • 正则表达式:Location: (.*)
  • 模板:$1$

在必要时将提取的值称为${location}

如果您的请求中有重定向,您可能还需要将“应用于”广播更改为Main sample and sub-samples

参考文献: