【问题标题】:Postman test - validating value in array邮递员测试 - 验证数组中的值
【发布时间】:2020-11-19 18:25:55
【问题描述】:

我在 Postman 中有一个测试,我可以在其中验证数组中的值。我遇到的问题是返回的值可以是随机的。 这就是我正在验证的 json 的样子。

[
    {
        "id": "7776",
        "revision": {
            "revisionId": "7780",
            "createdByUserId": "Lakare12",
            "createdDateTime": "2020-07-29T16:49:34.000+05:30"
        },
        "identifiers": [
            {
                "system": "urn:oid:1.2.752.129.2.1.4.1",
                "value": "CDE473Child1",
                "use": "primary",
                "displayValue": null
            }
        ],
        "name": "AA Child 01",
        "active": true,
        "hasChildren": false,
        "parentUnitId": "7768"
    },
    {
        "id": "7783",
        "revision": {
            "revisionId": "7783",
            "createdByUserId": "Lakare12",
            "createdDateTime": "2020-07-30T08:47:40.000+05:30"
        },
        "identifiers": [
            {
                "system": "urn:oid:1.2.752.129.2.1.4.1",
                "value": "CDE473Child3",
                "use": "primary",
                "displayValue": null
            }
        ],
        "name": "BB main Child 03",
        "active": true,
        "hasChildren": false,
        "parentUnitId": "7768"
    }
]

我需要测试该名称是否包含BB main Child 03

【问题讨论】:

  • 请格式化您问题中的 JSON 块

标签: arrays validation testing duplicates postman


【解决方案1】:

您可以遍历数组并检查每个数组元素中的名称。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-15
    • 2021-01-27
    • 1970-01-01
    • 2020-01-04
    • 2018-12-14
    • 1970-01-01
    • 1970-01-01
    • 2019-05-14
    相关资源
    最近更新 更多