Skip to main content

generate test case code

Project description

简介

gtc(generate test case) 是一个把http请求转换为测试代码的cli工具

功能

  • 支持解析curl命令
  • 支持解析postman文件
  • 支持解析swagger2文件
  • 支持解析openapi文件
  • 支持生成笛卡尔积测试脚本
  • 支持解析curl文件并生成Jmeter性能脚本
  • 支持解析curl文件并生成Locust性能脚本

安装

pip3 install gentccode
gtc version

使用

  1. 执行下面命令,会在当前目录生成api文件(api.yaml)和测试代码的脚本文件(test_case.py)

    gtc curl curl.txt -a res.code=0
    gtc postman postman.json
    gtc swagger2 swagger.json
    
  2. 根据笛卡尔积算法生成用例脚本

    # 对请求中的body进行操作
    gtc cp -n . -p body curl.txt
    gtc cp -n filter. -p body curl.txt
    
    # 对请求中的query param进行操作
    gtc cp -n . -p query curl.txt
    
  3. 执行下面命令,会生成对应的压测脚本

    # jsonassert 是对response的断言, rate 是tps, time 是 5min
    gtc jmeter curl.txt --jsonassert code=0 --rate 10 --time 5
    # locust脚本 
    gtc locust curl.txt
    

已知问题

  • 若postman文件中有变量,则不会生成相对应的代码块.

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

gentccode-0.3.3.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gentccode-0.3.3-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file gentccode-0.3.3.tar.gz.

File metadata

  • Download URL: gentccode-0.3.3.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.2 Darwin/24.6.0

File hashes

Hashes for gentccode-0.3.3.tar.gz
Algorithm Hash digest
SHA256 61a72259265e600a84b040b9fc1124c7a159495722219eb5e948aa2c238586f1
MD5 e1d78f19327e7855f7f70758dfab8581
BLAKE2b-256 722f22c0a27c4d59230b129e02b9c5595731a76fe4c9366963b3c81e8276bc4a

See more details on using hashes here.

File details

Details for the file gentccode-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: gentccode-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.2 Darwin/24.6.0

File hashes

Hashes for gentccode-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f3e51379f00d23475208dc4ac85a43808d0953d53ca643e17b8d78186bc5a4f6
MD5 4cc34edc762b5daa76c65b62f56d6359
BLAKE2b-256 53ddd129a103f1d98145a8121ec117ec3fffdbe37c3b4acebc90c15d0864c0dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page