Skip to main content

swagger convert jmx

Project description

swaggerjmx

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

English Document

Logo

logo

安装

pip install -U swaggerjmx

仓库地址

社区地址

适用场景

  1. 由于接口测试脚本编写耗时,而且需要持续维护,耗时耗力,使用此工具可以一键生成接口测试脚本。
  2. swagger-ui接口文档一键生成jmx文件供jmeter使用。
  3. yapi接口文档一键生成jmx文件供jmeter使用。

功能

  1. 将swagger-ui文档转换为jmx文件。
  2. 将yapi文档转换为jmx文件。

代码方式

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

截图:

  1. 传入红框中的swagger-ui 地址

image

  1. 生成的jmx文件

image

  1. jmeter中显示

image

趋势图

Stargazers over time

Contributors

贡献

git clone git@github.com:Pactortester/swaggerjmx.git
cd swaggerjmx
pip install -e .

以上便是 swaggerjmx 的基本用法介绍。

如果您有发现错误,或者您对 swaggerjmx 有任何建议,欢迎到 swaggerjmx Issues 发表,非常感谢您的支持。您的反馈和建议非常宝贵,希望您的参与能帮助 swaggerjmx 做得更好。

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

swaggerjmx-1.1.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

swaggerjmx-1.1.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file swaggerjmx-1.1.1.tar.gz.

File metadata

  • Download URL: swaggerjmx-1.1.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for swaggerjmx-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2cd929701fb2961e9358f6094d1f26457a8fabe62d1bc353e9eb7623b648b096
MD5 c8c97d8b7eaa567282e3548d5e6588af
BLAKE2b-256 a3316564169568bae596a919d99fec7e425955a85a4388d4cdc3a81ec1b2aa39

See more details on using hashes here.

Provenance

File details

Details for the file swaggerjmx-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: swaggerjmx-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for swaggerjmx-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0ff6510ae69e7a98cd02f83bd4617070d82b5cdb9ad689d0a4a3d80746e0166b
MD5 7dc95b18cac6bec9ef92645e291a32de
BLAKE2b-256 d173dda0a862385299eab7f251499a01d9d816ccc29f454124ccd4a6f8348fd1

See more details on using hashes here.

Provenance

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