Zeinab Abbasimazar
Zeinab Abbasimazar

Reputation: 10449

newman run subdirectory of a collection

I have a collection containing some directories which they also have subdirectories.

{
    "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
                }
            ]
        }
    ]
}

I want to run just D22 from the whole collection; here are what I've tried:

  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"

None of them worked.

BTW newman run my-collection.json -e my-environ.json --folder "D2" runs fine; it executes tests in both D21 and D22.

EDIT 1:

The newman version is 3.9.1.

Upvotes: 1

Views: 3986

Answers (1)

Francisco Edno
Francisco Edno

Reputation: 21

On newman 4.5.4 executing newman run my-collection.json -e my-environ.json --folder "D22" should work just fine

Upvotes: 2

Related Questions