简介
gtc(generate test case) 是一个把http请求转换为测试代码的cli工具
功能
- 支持解析curl命令
- 支持解析postman文件
- 支持解析swagger2文件
- 支持解析openapi文件
- 支持生成笛卡尔积测试脚本
- 支持解析curl文件并生成Jmeter性能脚本
- 支持解析curl文件并生成Locust性能脚本
安装
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文件中有变量,则不会生成相对应的代码块.
Metadata
Release files for gentccode 0.3.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gentccode-0.3.10.tar.gz | 18.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gentccode-0.3.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.7 kB
Release files / gentccode-0.3.10.tar.gz
| Download URL | gentccode-0.3.10.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3aff011ea38928471bde654d4dc8e029ef4d88f7206ecc0d2ffed74d8869bda
|
|
BLAKE2b-256 checksum How to use checksums |
7c44c9bb0b7f3407a849bd628bc78cf212cdcc7aafd12f8912bff01d7c9155c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.5 Darwin/25.3.0
|
Release files / gentccode-0.3.10-py3-none-any.whl
| Download URL | gentccode-0.3.10-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15860be9427b12b76a5eb2aed2d22e33c633adc3f157c31371c083049b72bfd1
|
|
BLAKE2b-256 checksum How to use checksums |
6344faaad036d8e19533c8efcbc434b7345c7d2c2ff7100166031ecff180fefb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.13.5 Darwin/25.3.0
|