Skip to main content

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

Metadata

Release files for interfacecases 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for interfacecases 0.1.0
File Size Uploaded Provenance Actions
interfacecases-0.1.0.tar.gz 3.4 kB Without provenance Details for interfacecases-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for interfacecases 0.1.0
File Interpreter ABI Platform Actions
interfacecases-0.1.0-py3-none-any.whl Python 3 none any Details for interfacecases-0.1.0-py3-none-any.whl

Total release size: 7.4 kB

Release files / interfacecases-0.1.0.tar.gz

Download URL interfacecases-0.1.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
39030e6b54ce536d569c011f64630bba6c9b7dff665fdf6d0cf660210a829f6e
BLAKE2b-256 checksum
How to use checksums
f4e57aedb69258f0c5aecec276d5ed083f3209b7d85fccc3956962f97d69c228
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / interfacecases-0.1.0-py3-none-any.whl

Download URL interfacecases-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07b3202300a9e6fe26c743950626054ac7c2b1e4f475835da7ce0bb46e968f80
BLAKE2b-256 checksum
How to use checksums
73379f586c96a47ec06c454f061d0fae6d35fd8ed2c4cf0bb01ced17e6dba257
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for interfacecases 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page