【问题标题】:JSON test errorJSON测试错误
【发布时间】:2019-01-09 22:47:02
【问题描述】:

JSON 文件响应正文:

{
    "Concurr": {
        "BPhoneNumber": null,
        "Agility": 1,
        "Email": "abcde@gg.com",
        "FirstName": "DIK",
        "LastName": "BO",
        "PhoneNumber": "03456778",
        "PhoneType": "",
        "PostalAddress": {
            "Address1": "47 ILZ RUE KLI EBRELES",
            "Address2": null,
            "Address3": null,
            "City": "OOL",
            "Country": "250",
            "Zip": "9760"
        },
        "PNSCode": ""
    },
    "DealID": 2,
    "ObjID": null,
    "OrderM": "IOPL",
    "Parts": [],
    "Product": {
        "ComRef": "IKOL341JKL        ",
        "PurchaseDate": "2018-07-12T06:31:13.053",
        "SerialNumber": "9501123456",
        "TRef": "S51M50X2EU/03"
    },
    "StNas": [
        {
            "AppointmentDate": "2018-08-02T10:03:27.8737443+02:00",
            "AppointmentRank": null,
            "Code": "100",
            "Comment": "",
            "Parts": []
        },
        {
            "AppointmentDate": "2018-08-02T10:03:27.8737443+02:00",
            "AppointmentRank": null,
            "Code": "1101",
            "Comment": "",
            "Parts": []
        }
    ],
    "SCode": null,
    "VID": 10
}

通过https://jsonschema.net 生成架构后,我正在使用此验证架构

var data = JSON.parse(responseBody);
tests["Valid scehma"] = tv4.validate(data, schema);

这总是在 Postman 中为我提供错误

There was an error in evaluating the test script : Cannot read property 'id' of null

任何人都可以帮助理解或就导致此错误的问题提供任何解决方案/感谢任何帮助

【问题讨论】:

    标签: json api testing automation postman


    【解决方案1】:

    ObjID": null 编辑为整数后,问题得到解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-11
      • 2019-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-24
      相关资源
      最近更新 更多