Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Convert POSTMAN data to JSON testcases for HttpRunner.

Project description

postman2runner

Convert postman data to JSON testcases for HttpRunner.

usage

To see postman2runner version:

$ python main.py -V

To see available options, run

$ python main.py -h
usage: main.py [-h] [-V] [--log-level LOG_LEVEL]
               [postman_testset_file] [-- output_dir] [-- output_file_type]

Convert postman testcases to JSON testcases for HttpRunner.

positional arguments:
  postman_testset_file  Specify postman testset file.
  -- output_dir   Optional. Specify converted JSON testset folder.
  -- output_file_type  Optional. Generate file format , default json.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         show version
  --log-level LOG_LEVEL Specify logging level, default is INFO.

examples

In most cases, you can run postman2runner like this:

$ python3 main.py tests/data/test.json --output_dir tests/postman2case --output_file_type yaml
INFO:root:Generate JSON testset successfully: output.json

As you see, the first parameter is postman source file path, and the second is converted JSON file path.

The output testset file type is detemined by the suffix of your specified file.

If you only specify postman source file path, the output testset is in JSON format by default and located in the same folder with source file.

$ python3 main.py tests/data/test.json
INFO:root:Generate JSON testset successfully: test/test.output.json

generated testset

generated JSON testset output.json shows like this:

[
    {
        "test": {
            "name": "/api/v1/Account/Login",
            "request": {
                "method": "POST",
                "url": "https://httprunner.top/api/v1/Account/Login",
                "headers": {
                    "Content-Type": "application/json"
                },
                "json": {
                    "UserName": "test001",
                    "Pwd": "123",
                    "VerCode": ""
                }
            },
            "validate": []
        }
    }
]

参考来源

HttpRunner

Project details


Download files

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

Files for postman2runner, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size postman2runner-0.0.2-py3-none-any.whl (10.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size postman2runner-0.0.2.tar.gz (7.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page