Skip to content

Latest commit

 

History

History
139 lines (95 loc) · 4.45 KB

README_en.md

File metadata and controls

139 lines (95 loc) · 4.45 KB

swaggerjmx

codecov PyPI PyPI - Python Version GitHub top language Downloads GitHub stars https://blog.csdn.net/flower_drop

Chinese Document

Logo

logo

Install

pip install -U swaggerjmx

Warehouse Address:

Community address

Applicable scene

  1. Since the writing of interface test scripts is time-consuming and requires continuous maintenance, which is time-consuming and labor-intensive, you can use this tool to generate interface test scripts with one click.
  2. The swagger-ui interface document generates jmx files with one click for use by jmeter.
  3. The yapi interface document generates a jmx file with one click for use by jmeter.

Features

  1. Convert swagger-ui documents to jmx file.
  2. Convert the yapi document to jmx file.

Code way

Demo_1

# -*- coding: utf-8 -*-

from swaggerjmx.convert import conversion
from swaggerjmx.settings import Settings as ST
#  swagger_url
ST.swagger_url = 'http://ip:port/v2/api-docs'
#  report_path
ST.report_path = 'jmx'
# Start conversion
conversion()

Demo_2

  • If you need to log in to access, you can copy the json information on the swagger_url page, save the json file, and use Demo_2 to convert.
# -*- coding: utf-8 -*-

from swaggerjmx.convert import conversion
from swaggerjmx.settings import Settings as ST
#  swagger_url_json_path 
ST.swagger_url_json_path = 'tests/data/swagger.json'
#  report_path
ST.report_path = 'jmx'
# Start conversion
conversion()

Command line mode

Preset parameters

(venv) lijiawei@bogon swaggerjmx % swaggerjmx -h
usage: swaggerjmx [-h] -i INPUT [-o OUTPUT]

Swagger or YApi convert jmx tool! Created: Lijiawei. Version 1.1.0

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        The input swagger json file or swagger url.
  -o OUTPUT, --output OUTPUT
                        The output jmx file path(default jmx). If it exists, new endpoints will be overwrite.

Usage

swaggerjmx -i <path_to_swagger_json_or_swagger_url> -o <path_to_output_jmx>

swagger json example

swaggerjmx -i tests/data/swagger.json -o jmx

swagger url example

swaggerjmx -i https://ip:port/v2/api-docs -o jmx

Screenshot:

  1. Pass in the swagger-ui address in the red box.

image

  1. Generated jmx file.

image

  1. display in jmeter.

image

Trend

Stargazers over time

Contributors

Contribute and develop

git clone [email protected]:Pactortester/swaggerjmx.git
cd swaggerjmx
pip install -e .

The above is an introduction to the basic usage of swaggerjmx.

If you find a bug, or if you have any suggestions for swaggerjmx, welcome swaggerjmx Issues published, thank you very much for your support. Your feedback and suggestions are very valuable, and I hope your participation can help swaggerjmx do better.