swaggerjmx
Logo
安装
pip install -U swaggerjmx
仓库地址
社区地址
适用场景
- 由于接口测试脚本编写耗时,而且需要持续维护,耗时耗力,使用此工具可以一键生成接口测试脚本。
- swagger-ui接口文档一键生成jmx文件供jmeter使用。
- yapi接口文档一键生成jmx文件供jmeter使用。
功能
- 将swagger-ui文档转换为jmx文件。
- 将yapi文档转换为jmx文件。
代码方式
Demo_1
- 可以直接访问 swagger_url (http://ip:port/v2/api-doc) 不需要登录的,使用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'
# 开始转换
conversion()
Demo_2
- 需要登录才能访问的,可以复制swagger_url页面上的json信息,保存json文件,使用Demo_2方式转换
# -*- coding: utf-8 -*-
from swaggerjmx.convert import conversion
from swaggerjmx.settings import Settings as ST
# swagger_url_json_path
ST.swagger_url_json_path = 'test.json'
# report_path
ST.report_path = 'jmx'
# 开始转换
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>
swagger json example
swaggerjmx -i tests/data/swagger.json -o jmx
swagger url example
swaggerjmx -i https://ip:port/v2/api-docs -o jmx
截图:
- 传入红框中的swagger-ui 地址
- 生成的jmx文件
- jmeter中显示
趋势图
Contributors
贡献
git clone git@github.com:Pactortester/swaggerjmx.git
cd swaggerjmx
pip install -e .
以上便是 swaggerjmx 的基本用法介绍。
如果您有发现错误,或者您对 swaggerjmx 有任何建议,欢迎到 swaggerjmx Issues 发表,非常感谢您的支持。您的反馈和建议非常宝贵,希望您的参与能帮助 swaggerjmx 做得更好。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
swaggerjmx-1.1.2.tar.gz
(15.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swaggerjmx-1.1.2.tar.gz.
File metadata
- Download URL: swaggerjmx-1.1.2.tar.gz
- Upload date:
- Size: 15.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57113b096cacb42f738e6103bcf5ba4d1f2b1c44d976f63aa2b163f5cea78cb4
|
|
| MD5 |
3169b9d214057d46e68c3c6703d7a187
|
|
| BLAKE2b-256 |
d72522eb04d6b6dad51259ad76980497a997361cac3a55dddf2a2ed4e59c7cff
|
File details
Details for the file swaggerjmx-1.1.2-py3-none-any.whl.
File metadata
- Download URL: swaggerjmx-1.1.2-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf133495591033d5540975f2905e68733628532a19852fc89aa1a884aa3830c
|
|
| MD5 |
eb0063e597abbccd13f39cbb079286fa
|
|
| BLAKE2b-256 |
3f784f42095343cfa87885e6f1761e376e32cc97e28bf1d6ad8def416c4260f3
|