Openapi2Postman creates automatic tests from Openapi 3.0 using postman format. Also, it creates environments files, depending of configuration. Those collections can be importend in postan application. The tests includes tests for 2xx, 4xx... and tests to validate output formats.
This repository is intended for community use, it can be modified and adapted without commercial use. If you need a version, support or help for your enterprise or project, please contact us π§ [email protected]
π’ If Openapi2postman is part of your organization's toolkit, we kindly encourage you to include your company's name in our Adopters list. π This not only significantly boosts the project's visibility and reputation but also represents a small yet impactful way to give back to the project.
Organization | Description of Use / Referenc |
---|---|
CloudAppi | Apification and generation of microservices |
Madrid Digital | Generation of microservices |
We're an inclusive and open community, welcoming you to join our effort to enhance ApiAddicts, and we're excited to prioritize tasks based on community input, inviting you to review and collaborate through our GitHub issue tracker.
Feel free to drop by and greet us on our GitHub discussion or Discord chat. You can also show your support by giving us some GitHub stars βοΈ, or by following us on Twitter, LinkedIn, and subscribing to our YouTube channel! π
npm i openapi2postman -g
argv | a | description |
---|---|---|
--file | -f | path openapi file |
--configuration | -c | path config file |
o2p -c .\example\o2p_config_file.json -f .\example\petstore.yaml
o2p -f .\example\petstore.yaml
If you do not use the -c argument, the following default configuration will be used. The output path target_folder
is ./out
.
api_name: filename,
is_inline: false,
schema_is_inline: false,
schema_pretty_print: true,
environments:[
{
name : "DEV",
postman_collection_name: "%api_name%_DEV",
postman_environment_name: "%api_name%_DEV",
target_folder: "./out",
has_scopes: false,
application_token: false,
number_of_scopes: 0,
microcks_headers: false
}
]
- Structure and submodules
- Build and run
- Contribute
- Documentation
- Advanced Functionality
- Additional resources
- docs - This module contents the guides to configurate and run the product. Documents Pdfs by CloudAppi.
- example - Integration and system tests for SoapUI.
- src β Source code
- test - Testing folder
You need node v10 or later.
Please review the o2p_config_file.json before to execute the command Execute node index.js --configuration o2p_config_file.json --file example/swagger_provincias.yml
The output files are the following (in example folder):
- SWAGGER_API_TestSuite_DEV.postman_collection.json
- SWAGGER_API_TestSuiteEnv_DEV.postman_environment.json
- SWAGGER_API_TestSuite_PROD.postman_collection.json
- SWAGGER_API_TestSuiteEnv_PROD.postman_environment.json
In postman:
- import generated postman collection file in postman
- import generated postman environment file in postman
- update variables in the envirnoment to test all cases
Collections and environments to generate can be configured using a JSON configuration file. Collection and environment name can be specified, as well as the target folder for resulting files, the authorizations collection to be used and some other characteristics. This configuration file has an specification and examples that can be read on the following document:
Configuration file openapi2postman. This document is only available in spanish by now. it will be soon translated to english.
an example configuration file is included in file structure.
Node.js and npm package manager are required to run the tool. Its adviced to use preconfigured installation tools provided by the manufacturer: https://nodejs.org/es/download/