Skip to main content

Convert SWAGGER data to JSON testcases for HttpRunner.

Project description

swagger2case

LICENSE Build Status coveralls

Convert swagger data to yaml testcases for HttpRunner.

usage

To see swagger2case version:

$ python main.py -V
0.0.1

To see available options, run

$ python main.py -h
usage: main.py [-h] [-V] [--log-level LOG_LEVEL]
               [swagger_testset_file] [output_testset_file]

Convert swagger testcases to JSON testcases for HttpRunner.

positional arguments:
  swagger_testset_file  Specify swagger testset file.
  output_testset_file   Optional. Specify converted JSON testset file.

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 swagger2case like this:

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

As you see, the first parameter is swagger 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 swagger source file path, the output testset is in JSON format by default and located in the same folder with source file.

$ python3 main.py test/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": []
        }
    }
]

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

swagger2case-0.0.1.tar.gz (7.0 kB view details)

Uploaded Source

File details

Details for the file swagger2case-0.0.1.tar.gz.

File metadata

  • Download URL: swagger2case-0.0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

File hashes

Hashes for swagger2case-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9329558a346188b691c07eee9d0476498592225574edd1c7e8d8f24d9946ff5a
MD5 1c82ab7c4b3ea34a207be1e528f7900c
BLAKE2b-256 76e4b45537f34b97d168c8d9bb45796a977a0b4775cdee861a1ece32b61861e6

See more details on using hashes here.

Supported by

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