断言错误:否断言失败:真断言失败消息:测试失败:预期文本匹配

时间:2020-03-28 13:43:07

标签: jmeter

我的响应声明侦听器状态:

Assertion error: false
Assertion failure: true
Assertion failure message: Test failed: text expected to match /{
:   "status":true,
:   "data":
:   [
:   :   {
:   :   :   "nDeviceId":67,
:   :   :   "deviceName":"new",
:   :   :   "timeZone":"UTC+5:30"
:   :   }
:   ],
:   "message":"List of devices ",
:   "statusCode":"dms-200-2006",
:   "traceId":"f4721140-8fdd-4af9-9e2d-fb897521c52c"
}/

我的响应数据为:

{
:   "status":true,
:   "data":
:   [
:   :   {
:   :   :   "nDeviceId":67,
:   :   :   "deviceName":"new",
:   :   :   "timeZone":"UTC+5:30"
:   :   }
:   ],
:   "message":"List of devices ",
:   "statusCode":"dms-200-2006",
:   "traceId":"f4721140-8fdd-4af9-9e2d-fb897521c52c"
}

我想知道如何处理响应断言开头添加的“ /”吗?

1 个答案:

答案 0 :(得分:0)

似乎您正在使用Matches模式匹配规则,该规则期望输入为PCRE,因此您需要转义所有meta characters

如果您想查看确切响应,则需要改用Equals模式:

enter image description here

更多信息:How to Use JMeter Assertions in Three Easy Steps