pip install -U swaggerjmx
- 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.
- The swagger-ui interface document generates jmx files with one click for use by jmeter.
- The yapi interface document generates a jmx file with one click for use by jmeter.
- Convert swagger-ui documents to jmx file.
- Convert the yapi document to jmx file.
- Can be accessed directly swagger_url (http://ip:port/v2/api-doc) Don’t need to log in, use Demo_1 to convert.
# -*- 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()
- 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()
(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.
swaggerjmx -i <path_to_swagger_json_or_swagger_url> -o <path_to_output_jmx>
swaggerjmx -i tests/data/swagger.json -o jmx
swaggerjmx -i https://ip:port/v2/api-docs -o jmx
- Pass in the swagger-ui address in the red box.
- Generated jmx file.
- display in jmeter.
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.