测试响应体的数据类型

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

我尝试验证这个响应数据

{
    "id": "1",
    "name": "Rahul",
    "location": "noida",
    "phone": "1234567890",
    "courses": [
        "java",
        "selenium"
    ]
}

为了测试我运行这个-

const jsonData=pm.response.json();
pm.test("Test Data Type of the response",()=>{ pm.expect(jsonData.id).to.be.a('integer');});

我得到了结果-

Test Data Type of the response | AssertionError: expected '1' to be an integer
javascript json postman web-api-testing
© www.soinside.com 2019 - 2024. All rights reserved.