jmeter 从返回html中提取,Jmeter数据关联(如何将返回的内容提取保存到变量)

该章节主要介绍的是jmeter 正则表达式提取器。html

If you need to add HTTP Request sampler with dynamic URL that can be different each time from testing to testing you must use one of the Post-Processors offered by JMeter. I usually use Regular Expression Extractor for this purposes.web

若是你想请求的http url地址每次都不同. 既请求的内容根据上次请求的返回内容而改变. 则咱们须要将上次请求的返回保存到某个变量里,而后在下一次的请求中使用(引用).  这样第二次的请求的值是动态变化的.  正则表达式

注意:若是正则表达式还不能知足您的需求, 请查阅jmeter bsf 处理器,能够本身编写脚本代码。express

例如 :dom

2.  返回含有  href="http://blog.whoistester.com"的内容, 经过正则表达式提取器 href="/([^"]+)"this

模式写$1$ , 变量名写url,  则提取器会将http://blog.whoistester.com的字符串保存到变量名为url的变量里.url

4.  下次请求则请求$url 地址. 具体的例子见下图. spa

So, let's imaging that you have "Popular News" web page which contains the links to "News Story" web pages that contains the full texts of news and you want to write a test which will include both "News" page and random "News Story" page.

For this you must include "News" page HTTP Request sampler inside Simple Controller with a Regular Expression Extractor to store random "News Story" page URL to a variable:

htm

ca3d92c010c040b9a827c932.html

Then use the variable with the stored random "News Story" page URL in "News Story" HTTP sampler:

ca3d92c010c040b9a827c932.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值