Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shotakitazawa/postman-apitest-autogen
generate Postman collection included tests from Postman collection recorded request & response
https://github.com/shotakitazawa/postman-apitest-autogen
cli postman postman-collection
Last synced: about 2 months ago
JSON representation
generate Postman collection included tests from Postman collection recorded request & response
- Host: GitHub
- URL: https://github.com/shotakitazawa/postman-apitest-autogen
- Owner: ShotaKitazawa
- License: mit
- Created: 2021-10-24T14:42:12.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-29T17:00:07.000Z (about 3 years ago)
- Last Synced: 2024-10-13T11:21:52.982Z (3 months ago)
- Topics: cli, postman, postman-collection
- Language: Go
- Homepage:
- Size: 1.97 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# postman-apitest-autogen
![License](https://img.shields.io/github/license/ShotaKitazawa/postman-apitest-autogen)
![test](https://github.com/ShotaKitazawa/postman-apitest-autogen/workflows/test/badge.svg)postman-apitest-autogen generate Postman collection included tests from Postman collection recorded request & response.
## Install
* download binary from [release](https://github.com/ShotaKitazawa/postman-apitest-autogen/releases)
## Usage
```
Usage of postman-apitest-autogen:
-collection-file string
filepath of postman_collection.json
-filter-file string
filepath of filter.json
-output-file string
filepath of output_collection.json (default "output.json")
-version
display version
```## How to use
* run Postman proxy & setting HTTP proxy
* ref. https://learning.postman.com/docs/sending-requests/capturing-request-data/capturing-http-requests/* record request and response to test-target server by Postman proxy & export to `collection.json`
![](./images/recording-request-and-response.gif)
* (optional) create filter.json
* can exclude specified fields from generate-test
* `ignoreJSONPointer` format is [rfc6901](https://datatracker.ietf.org/doc/html/rfc6901)```jsonnet
[
{
// exclude `.[0].created_at` in test title is "title01"
"testname": "title01"
"ignoreJSONPointer": "0.created_at",
},
{
"testname": "title01"
"ignoreJSONPointer": "1.created_at",
}
]
```* (optional, recommendation) create filter.json from jsonnet
* because [rfc6901](https://datatracker.ietf.org/doc/html/rfc6901) cannot express wildcard.```jsonnet
[
{
testname: 'title01',
ignoreJSONPointer: '%d.created_at' % [i],
}
for i in std.range(0, 1)
]
```* run postman-apitest-autogen & import `output.json` to Postman
* if filter format is jsonnet, replace to `-filter-file <(jsonnet filter.jsonnet)````
postman-apitest-autogen -collection-file collection.json -filter-file filter.json -output-file output.json
```* tests are generated!
![](./images/tests-are-generated.png)