簡體   English   中英

Jmeter:如何使用 csv 文件中的字段名稱構造 JSON 路徑,以將 API 響應中的數據與 DB 中的數據進行比較

[英]Jmeter: how to construct JSON Path using field names from csv file to compare data from API response with data from DB

我有一個返回以下響應的 API:

 {
    "data": {
        "response": {
            "employee": 
                {
                   "firstName": "Frank",
                   "lastName": "Porter",
                   "employeeNumber": "11102"
                }
            }
        }
}

最簡單的方法 - Eval.me

def jsonResponse = new JsonSlurper().parse(...)
def jpath = 'BODY.data.response.employee.firstName' // get it from where you want
assert Eval.me('BODY', jsonResponse, jpath)=='Frank'

嘗試類似:

data.response.employee.get('t')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM