Skip to main content

Create and Export Postman collections

Project description

Usage

  1. Setup: make setup
  2. Unit Tests: make tests
  3. Build dist: make dist

Scope of Work

The scope of this project is to design and implement a template engine, which converts a custom template to Postman collection in JSON format. This improves manageability and reusability of API collections and tests.

Broad Area of Work

Postman is an application used for API testing. It is an HTTP client that tests HTTP requests, utilizing a graphical user interface, through which we obtain different types of responses that need to be subsequently validated. The current research project focus is on developing a template engine that can produce postman collections in JSON format.

image6

Background

Testing is one of the most critical processes of the Software Development Lifecycle (SDLC). It helps companies to perform a comprehensive assessment of software and ensure that their product fulfills the client’s needs.

The CI/CD pipeline approach has emerged as a result of a tendency for today’s software users to be less and less tolerant towards defects and at the same time expect fast updates and fixes. Testing is one process that can and should be automated to a great extent within the CI/CD pipeline.

Postman is an application that is used for API testing. Newman is a command-line Collection Runner for Postman. It enables you to run and test a Postman Collection directly from the command line. It is built with extensibility in mind so that you can easily integrate it with your continuous integration servers and build systems.

The Postman collections created via the GUI have to be exported as in JSON format, which is used by the Newman client. Postman lacks the ability to reuse requests, tests, and pre-request scripts. It is also difficult to maintain postman collections in JSON format in version control systems as the collection has to be exported after each change.

Objectives

The objectives of project are as follows:

  1. Create a template engine for postman which can be used to define collections and requests.
  2. The template engine will generate postman collection in JSON format, which can be imported by Postman GUI application or run using Newman client

Example

   collection = Collection("sample_collection")
   request = Request("Yahoo request", HTTP_METHOD.GET,"", [], Url("https://www.yahoo.com"))
   collection.add_request(request)

   request = Request("Google request", HTTP_METHOD.GET,"", [], Url("https://www.google.com"))
   collection.add_request(request)

   template = collection.get_template_object()
   render = collection.render(template)

Output:

{
    "info": {
        "_postman_id": "63c64688-0373-4f34-b0e0-7708cbe41c3b",
        "name": "sample_collection",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [{
            "name": "Yahoo request",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "www.yahoo.com", 
                    "protocol": "https",
                    "host": ["www", "yahoo", "com"]
                },
                "description": ""
            },
            "response": []
        }, {
            "name": "Google request",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "www.google.com", 
                    "protocol": "https",
                    "host": ["www", "google", "com"]
                },
                "description": ""
            },
            "response": []
        }]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postmanrenderer-1.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

postmanrenderer-1.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file postmanrenderer-1.0.1.tar.gz.

File metadata

  • Download URL: postmanrenderer-1.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for postmanrenderer-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b7db87ce1bc1c3e3996d35fb943d4c9ba69f96f08a39494b1a8714c134af849b
MD5 f6c5a665e8a4f1f0f372dd3f7fe75c6a
BLAKE2b-256 9f7a74e6a3f275c47f881c31af869c799ba2872475ccb7c54e25f9a369e908b8

See more details on using hashes here.

File details

Details for the file postmanrenderer-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: postmanrenderer-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for postmanrenderer-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d00facb87d37dac842060e1a17925210afc0dc6c3d5e81b75c70e5f25e14443
MD5 989f6358361bd496980038259285b041
BLAKE2b-256 663fd88f3c1fc1872573784192601d58745e6a679854acc5d3905b0dbeec2d3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page