提供接口测试用例生成方法
Project description
interface_testcases
接口多参数测试用例生成
功能测试
- 正常值paris-2组合的用例
- 异常值用例
- 不传必选参数用例
- 不传全部可选参数的用例
使用指南
安装
方法1. pip安装:pip install -i --upgrade
方法2. 下载源代码:git clone git@github.com:caiyizhang/interface_testcases.git
$ cd interface_testcases
$ pip install .
示例
# 传入参数一行代表一个参数,一个参数有3个属性。
# 前两个是列表,最后一个是布尔类型。分别是正常值、异常值和是否必选参数
params = [
[[1, 2], [0, 3], False],
[[-1, -2], [0, -3], True],
[[-3, 3], [-2, 4], False]
]
for case in InterfaceTestcases(params):
print(case)
# 结合pytest
@pytest.mark.parametrize(['param_1', 'param_2', 'param_3', 'normal_flag'], [
value_list for value_list in InterfaceTestcases([
[['1', '10'], ['0', '7'], True],
[["1", '10', '100'], ['0', '101'], False],
[[None, '', 2161524184], ['1'], False],
[[None, '', '1', '11'], [0, 'f2rewrawr'], False]
])
])
def test_1(self, param_1, param_2, param_3, normal_flag):
params = {
'param_1': param_1,
'param_2': param_2,
'param_3': param_3
}
# params删除不传入的参数
params = {k: v for k, v in params.items() if v != 'no_param'}
if normal_flag == 'normal':
do_something_normal()
elif normal_flag == 'abnormal':
do_something_abnormal()
else:
pass
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
interfacecases-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file interfacecases-0.1.0.tar.gz
.
File metadata
- Download URL: interfacecases-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39030e6b54ce536d569c011f64630bba6c9b7dff665fdf6d0cf660210a829f6e |
|
MD5 | 7a864dce788cb27dccb4fc3d9e527966 |
|
BLAKE2b-256 | f4e57aedb69258f0c5aecec276d5ed083f3209b7d85fccc3956962f97d69c228 |
File details
Details for the file interfacecases-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: interfacecases-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07b3202300a9e6fe26c743950626054ac7c2b1e4f475835da7ce0bb46e968f80 |
|
MD5 | a2710a9b0367b83ad4307729d3603df4 |
|
BLAKE2b-256 | 73379f586c96a47ec06c454f061d0fae6d35fd8ed2c4cf0bb01ced17e6dba257 |