I am writing a test case which will hit a URLs and send email if response code is 404. Request is going well and Response also coming but I am stuck at Regular Expression Extractor.Sample Request Result
我正在编写一个测试用例,如果响应代码是404,它将访问url并发送电子邮件。请求进行得很顺利,响应也来了,但是我被困在正则表达式提取器中。示例请求结果
![Sample Result for HTTP Request][Extractor Page]
![HTTP请求的示例结果][提取器页面]
2 个解决方案
#1
2
- Amend your Regular Expression to be
\d+
- 修正你的正则表达式为\d+。
- Add If Controller after the "Landing Page Verification" request and use
"${responsemsg}" == "404"
as the condition - 在“登录页面验证”请求后添加If控制器,并使用“${responsemsg}”=“404”作为条件
- Make SMTP Request sampler a child of the If Controller
- 使SMTP请求采样器成为If控制器的一个子程序
Example Test Plan snapshot
快照示例测试计划
#2
1
Change the regular expression to (\d+) and template to $1$ and match no. to 1. see using regex with jmeter and Regular Expressions from jmeter user manual for more information.
将正则表达式更改为(\d+),模板更改为$1,匹配号。为1。有关更多信息,请参见使用带jmeter的regex和jmeter用户手册中的正则表达式。
#1
2
- Amend your Regular Expression to be
\d+
- 修正你的正则表达式为\d+。
- Add If Controller after the "Landing Page Verification" request and use
"${responsemsg}" == "404"
as the condition - 在“登录页面验证”请求后添加If控制器,并使用“${responsemsg}”=“404”作为条件
- Make SMTP Request sampler a child of the If Controller
- 使SMTP请求采样器成为If控制器的一个子程序
Example Test Plan snapshot
快照示例测试计划
#2
1
Change the regular expression to (\d+) and template to $1$ and match no. to 1. see using regex with jmeter and Regular Expressions from jmeter user manual for more information.
将正则表达式更改为(\d+),模板更改为$1,匹配号。为1。有关更多信息,请参见使用带jmeter的regex和jmeter用户手册中的正则表达式。