gpt4 book ai didi

json - Jmeter JSON 路径断言

转载 作者:行者123 更新时间:2023-12-02 10:18:11 25 4
gpt4 key购买 nike

下面是我的 JSON 响应数据,我需要使用下面的响应进行断言。我尝试了多种方式来编写 JSON 路径和期望值。断言总是失败。我想要的是请帮忙写出以下数据的路径和期望值

{
"statusCode": 200,
"statusMessage": "Success",
"errorMessage": "",
"responseData": {
"id": 15,
"userName": "partner@tarento.com",
"firstName": "tarento",
"lastName": "test1",
"phoneNumber": "1234567812",
"email": "partner@tarento.com",
"password": "",
"city": "",
"agentList": [
{
"id": 37,
"userName": "Rahul.antonyRaj@tarento.com",
"firstName": "Sanjay",
"lastName": "rahul",
"phoneNumber": "7411269480",
"email": "Rahul.antonyRaj@tarento.com",
"password": "",
"active": true
},
{
"id": 68,
"userName": "jinesh.sumedhan@tareto.com",
"firstName": "jinesh",
"lastName": "sumedhan",
"phoneNumber": "9400993826",
"email": "jinesh.sumedhan@tareto.com",
"password": "",
"active": true
},
{
"id": 108,
"userName": "a.sanjayrahul@gmail.com",
"firstName": "Rahul",
"lastName": "Antony",
"phoneNumber": "9994590241",
"email": "a.sanjayrahul@gmail.com",
"password": "",
"active": true
},
{
"id": 304,
"userName": "a.sanjayrajish@gmail.com",
"firstName": "Agent",
"lastName": "Agent",
"phoneNumber": "9025699716",
"email": "a.sanjayrajish@gmail.com",
"password": "",
"active": true
}
],
"roleName": "admin",
"sessionKey": "435tnerLt9813942160478oDse46345635#1",
"partner": {
"id": 1,
"name": "Tarento",
"cityList": [
"bangalore",
"mumbai"
],
"phone": "1234567812",
"url": ""
},
"isActive": true,
"isDeleted": false,
"roleId": 1,
"countryCode": "",
"tags": [
{
"tagId": 1,
"name": "all",
"description": "this is default tag of all driver."
},
{
"tagId": 2,
"name": "airport",
"description": ""
},
{
"tagId": 3,
"name": "street",
"description": "any text message"
},
{
"tagId": 255,
"name": "night",
"description": "night"
}
]
}
}

我收到了以下回复

最佳答案

首先,以下 JSONPath 断言将测试您的 statusCode

$.statusCode

200 放入 JSONPath 断言的预期值。

这适用于用户名

$.responseData.userName

很简单,不是吗?请参阅Parsing JSON有关更多有用示例和操作方法的指南。

关于json - Jmeter JSON 路径断言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22006542/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com