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

问题描述 投票:0回答:1

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

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"
}

我想知道如何解决响应断言开头添加的“ /”?

jmeter
1个回答
0
投票

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

如果要检查精确响应,则需要切换为使用Equals模式:

enter image description here

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

© www.soinside.com 2019 - 2024. All rights reserved.