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
使用
-
执行下面命令,会在当前目录生成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文件中有变量,则不会生成相对应的代码块.
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.3.6.tar.gz
(18.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
gentccode-0.3.6-py3-none-any.whl
(22.5 kB
view details)
File details
Details for the file gentccode-0.3.6.tar.gz.
File metadata
- Download URL: gentccode-0.3.6.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.2 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d18734f5b8063a164224d353195fb2499c7165283f9ea02887b420855a4a34d
|
|
| MD5 |
7fddf4e96eb0c6af829fa9d8a8c00c71
|
|
| BLAKE2b-256 |
71ad994cb7f6a41c7b8cb1fb4b79c4b1e1c2c7f24959133d68ff5017dbcac229
|
File details
Details for the file gentccode-0.3.6-py3-none-any.whl.
File metadata
- Download URL: gentccode-0.3.6-py3-none-any.whl
- Upload date:
- Size: 22.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75afcb8a71a48e0ab37f3c7a794d54ab33f3dc6b3cc8b7cf074d8017f4e5ec08
|
|
| MD5 |
16bac4edec61f51857e2ae431d639aa0
|
|
| BLAKE2b-256 |
3e46ebdb45f6beba9201be022174b9e9153db200310e16723961585b74eb45dd
|