generate test case code
Project description
简介
gtc(generate test case) 是一个把http请求转换为测试代码的cli工具
功能
- 支持解析curl命令
- 支持解析postman文件
- 支持解析swagger2文件
- 支持解析openapi文件
- 支持生成笛卡尔积测试脚本
- 支持解析curl文件并生成Jmeter性能脚本
- 支持解析curl文件并生成Locust性能脚本
- 一键生成Jmeter性能压测方案脚本
安装
pip3 install gentccode
gtc version
使用
-
执行下面命令,会在当前目录生成api文件(
api.yaml
)和测试代码的脚本文件(test_case.py
)gtc curl curl.txt -a res.code=0 gtc postman postman.json gtc swagger2 swagger.json
-
根据笛卡尔积算法生成用例脚本
# 对请求中的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
-
执行下面命令,会生成对应的压测脚本
# jsonassert 是对response的断言, rate 是tps, time 是 5min gtc jmeter curl.txt --jsonassert code=0 --rate 10 --time 5 # locust脚本 gtc locust curl.txt
已知问题
- 若postman文件中有变量,则不会生成相对应的代码块.
- url中必须有http或https协议头
Project details
Release history Release notifications | RSS feed
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.2.19.tar.gz
(17.9 kB
view details)
Built Distribution
File details
Details for the file gentccode-0.2.19.tar.gz
.
File metadata
- Download URL: gentccode-0.2.19.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 467b5626cafbdf1955e6a46499cb3e527531d6ded774a5f0082c019f75c02f2a |
|
MD5 | f8107c5572bdc3d97db74f3f4a05030d |
|
BLAKE2b-256 | d42f3579d4b3a08cfe348758601ebe50e348a075781172ea42e42620ec7f9161 |
File details
Details for the file gentccode-0.2.19-py3-none-any.whl
.
File metadata
- Download URL: gentccode-0.2.19-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 648b77abd3da1412b68b0718d3f576a352f3a048115dbbe8643d88dc9f6ad9fb |
|
MD5 | f54bfd87f22936b35f6d678cb7de2bf2 |
|
BLAKE2b-256 | fc8587a5c033421ba51c2316b827a4f09c574a01c117c0f6bdd104ed4e4217a9 |