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 做得更好。
Metadata
Release files for swaggerjmx 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swaggerjmx-1.1.2.tar.gz | 15.9 kB | Without provenance | Details for swaggerjmx-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swaggerjmx-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for swaggerjmx-1.1.2-py3-none-any.whl |
Total release size: 28.6 kB
Release files / swaggerjmx-1.1.2.tar.gz
| Download URL | swaggerjmx-1.1.2.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57113b096cacb42f738e6103bcf5ba4d1f2b1c44d976f63aa2b163f5cea78cb4
|
|
BLAKE2b-256 checksum How to use checksums |
d72522eb04d6b6dad51259ad76980497a997361cac3a55dddf2a2ed4e59c7cff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / swaggerjmx-1.1.2-py3-none-any.whl
| Download URL | swaggerjmx-1.1.2-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaf133495591033d5540975f2905e68733628532a19852fc89aa1a884aa3830c
|
|
BLAKE2b-256 checksum How to use checksums |
3f784f42095343cfa87885e6f1761e376e32cc97e28bf1d6ad8def416c4260f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Security for swaggerjmx 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.