Auto Create PyTest Frame and Fake Test Parameters For Red
Project description
项目描述
通过解析IDL自动生成PyTest单测框架, 通过Faker库辅助生成部分参数, 并且支持单测参数和单测逻辑的向后兼容
安装
pip install pyaml
pip install Faker==1.0.4
pip install bson
示例代码
from auto_red_test import generate_red_test
from frame import ENV
from handler.stockage_handler import StockageHandler as test_handler # 需要单测的handler
import stockage_service.request.ttypes as test_request # idl的request文件
import stockage_service.StockageService as test_service # idl的service文件
root_path = ENV['root'] # 项目的根目录
generate_red_test(root_path, test_handler, test_service, test_request)
- 自动生成的单测框架如下:
补充内容
- 第一次运行会生成request_config.yaml,可以自定义单测方法的参数,用于解决一个单测方法用到多个request的特殊情况, 格式如下:
# 配置单测参数
methodA:
request_nameA: request_A_obj_name
request_nameB: request_A_obj_name
methodB:
request_nameB: request_B_obj_name
request_nameC: request_C_obj_name
methodA为单测方法名, request_nameA为请求参数名,request_A_obj_name为请求参数对应的IDL Request名
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
auto-red-test-0.1.2.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for auto_red_test-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5386a72aec2e679bd510c9d69fe66e09f45d1c451f40a6ebd1fb0a65d10c3aa5 |
|
MD5 | a59fd5c1ee04634f6b6f68d7aa33a8ca |
|
BLAKE2b-256 | 2cd925caa6c8fcd822b1e1d5013f3c8514d707830cc05b7c0c825cf552e00125 |