kuroco-newman is an internal-use npm package to manage/run Postman collections at any repository easily.
npm i --save-dev github:diverta/kuroco-newman
You need to follow the steps below at least to use kuroco-newman package.
- Put Postman collection files under specific directory structure
- Create
kuroco-newman.config.json
See tutorial_ja.md (Japanese version only)
You can use kuroco-newman
cli to initialize your repository and run/manage your collection files.
npx kuroco-newman init
# Run all Postman collections configured in kuroco-newman.config.json
npx kuroco-newman run
# Run only specific Postman collection
npx kuroco-newman run -e path/to/your/environment_file -c path/to/your/collection_file
kuroco-newman.config.json
must exist in the root of your repository.- Postman collection files must always be put under the specific directory structure.
/
|-- kuroco-newman.config.json
`-- {directory_to_put_testing_files} # Any directory name to put your postman files
`-- {target_site} # Any identifier for your testing target
|-- collections # Postman collections
| `-- {id} # [Optional] Any identifier of your target collection (API id, API name, etc)
| |-- {category_name_1} # Any category name for your collections files (unit, integration, etc)
| | `-- *.postman_collection.json
| `-- {category_name_2} # (You can make multiple categories if you need)
| `-- *.postman_collection.json
|-- environments # Postman environments
| `-- *.postman_environment.json
`-- fixtures # Fixture files for test scripts
`-- *.*
Example
/
|-- kuroco-newman.config.json
`-- tests
`-- kuroco-test
|-- collections
| `-- 1
| |-- unit
| | `-- Kuroco-test-unit.postman_collection.json
| `-- integration
| |-- Kuroco-test-specs-scenario.postman_collection.json
| `-- Kuroco-test-specs-pattern.postman_collection.json
|-- environments
| `-- Kuroco-test.postman_environment.json
`-- fixtures
`-- diverta.png
{
"baseDir": "path/to/base/directory",
"report": {
"outputDir": "path/to/output/report/files",
"options": {
"index": {},
"htmlextra": {}
}
},
"target": [
{
"name": "target_site",
"environment": "file_name.postman_environment.json",
"collections": [
{
"id": "id",
"files": {
"category_name": "*.json"
}
}
]
}
]
}
Collection id can be omitted. In that case, the configuration should be as follows.
`-- collections
|-- unit
| `-- Kuroco-test-unit.postman_collection.json
`-- integration
|-- Kuroco-test-specs-scenario.postman_collection.json
`-- Kuroco-test-specs-pattern.postman_collection.json
"collections": [
{
"files": {
"category_name": "*.json"
}
}
]