【问题标题】:newman run subdirectory of a collectionnewman 运行集合的子目录
【发布时间】:2018-09-20 23:32:39
【问题描述】:

我有一个包含一些目录的集合,它们也有子目录。

{
    "variables": [],
    "info": {
        "name": "MyCollection",
        "_postman_id": "9d4b89df-4e52-e51b-59d1-4baa2c6a424f",
        "description": "",
        "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
    },
    "item": [
        {
            "name": "D1",
            "description": "",
            "item": [
                {
                    "name": "D11",
                    "description": "",
                    "item": [
                        {
                            "name": "my_report",
                            "request": {
                                "url": "http://192.168.100.139:1998/api/my_report",
                                "method": "POST",
                                "header": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json",
                                        "description": ""
                                    }
                                ],
                                "body": {
                                    "mode": "raw",
                                    "raw": "{\"name\": \"zizi\"}"
                                },
                                "description": ""
                            },
                            "response": []
                        }
                    ],
                    "_postman_isSubFolder": true
                }
            ]
        },
        {
            "name": "D2",
            "description": "",
            "item": [
                {
                    "name": "D22",
                    "description": "",
                    "item": [
                        {
                            "name": "my_report",
                            "request": {
                                "url": "http://192.168.100.139:1998/api/my_report",
                                "method": "POST",
                                "header": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json",
                                        "description": ""
                                    }
                                ],
                                "body": {
                                    "mode": "raw",
                                    "raw": "{\"name\": \"zizi\"}"
                                },
                                "description": ""
                            },
                            "response": []
                        }
                    ],
                    "_postman_isSubFolder": true
                },
                {
                    "name": "D21",
                    "description": "",
                    "item": [
                        {
                            "name": "my_report",
                            "request": {
                                "url": "http://192.168.100.139:1998/api/my_report",
                                "method": "POST",
                                "header": [
                                    {
                                        "key": "Content-Type",
                                        "value": "application/json",
                                        "description": ""
                                    }
                                ],
                                "body": {
                                    "mode": "raw",
                                    "raw": "{\"name\": \"zizi\"}"
                                },
                                "description": ""
                            },
                            "response": []
                        }
                    ],
                    "_postman_isSubFolder": true
                }
            ]
        }
    ]
}

我只想从整个集合中运行D22;这是我尝试过的:

  1. newman run my-collection.json -e my-environ.json --folder "D22"
  2. newman run my-collection.json -e my-environ.json --folder "D2/D22"
  3. newman run my-collection.json -e my-environ.json --folder "D2.D22"

他们都没有工作。

顺便说一句 newman run my-collection.json -e my-environ.json --folder "D2" 运行良好;它在D21D22 中执行测试。

编辑 1:

newman 版本是3.9.1

【问题讨论】:

标签: testing postman web-api-testing newman


【解决方案1】:

在 newman 4.5.4 上执行 newman run my-collection.json -e my-environ.json --folder "D22" 应该可以正常工作

【讨论】:

    猜你喜欢
    • 2018-05-26
    • 2017-11-03
    • 2020-05-20
    • 2020-03-16
    • 2019-12-14
    • 2017-08-17
    • 2016-11-15
    • 2022-01-18
    • 2021-08-25
    相关资源
    最近更新 更多