Skip to content

Project open source financed by Madrid Digital (Spain) and CloudAPPi S.L and promoted by APIAddicts. With this project, you can generate all tests automatically using a Swagger document, and you can add it to CI using newman.

License

apiaddicts/openapi2postman

Repository files navigation

πŸ› οΈ Openapi2Postman Release OpenApi Postman NPM License: LGPL v3

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 :octocat: 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]

Twitter Discord LinkedIn Facebook YouTube

πŸ™Œ Join the Openapi2postman Adopters list

πŸ“’ 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

πŸ‘©πŸ½β€πŸ’» Contribute to ApiAddicts

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! πŸš€

"Buy Me A Coffee"

πŸ“‘ Getting started

NPM

Install package

npm i openapi2postman -g

First steps

Arguments

argv a description
--file -f path openapi file
--configuration -c path config file

Normal usage

o2p -c .\example\o2p_config_file.json -f .\example\petstore.yaml

Default config

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

Table of content

Structure and submodules

  • 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

Build and run

Prerequisites

You need node v10 or later.

run

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

Configuration file

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.

Workspace configuration

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/

πŸ’› Sponsors

cloudappi md

About

Project open source financed by Madrid Digital (Spain) and CloudAPPi S.L and promoted by APIAddicts. With this project, you can generate all tests automatically using a Swagger document, and you can add it to CI using newman.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published