newman run集合的子目录

时间:2018-04-11 07:28:55

标签: testing postman web-api-testing newman

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

{
    "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"
  4. 他们都没有奏效。

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

    编辑1:

    newman版本为3.9.1

1 个答案:

答案 0 :(得分:0)

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