Skip to main content

接口测试平台测试用例执行引擎

Project description

API AutoTest Runner

A lightweight and flexible execution engine for API automated testing, supporting multiple test case organization forms, environment variable injection, and custom script extension.

Core Features

Support three test case organization forms: single case / single scenario (multiple cases) / multiple scenarios (multiple cases)

Dynamic environment variable injection (support custom functions)

Pre/post script extension

Built-in database connection configuration (MySQL)

Clear execution results (success/failure count + logs)

Installation

pip install api-engine-xin

1、Basic Usage

from api-engine-xin import TestRunner



# 执行测试用例

result = TestRunner(test_suites, test_env_data).execute_cases()

print(f"result: success: {result['success']}, fail: {result['failed']}")

print(f"log: {result['logs']}")

2、Test Case definition:

format 1: single test case


test_suites = {

    "title": "Login Success",

    "interface": {

        "url": "/member/public/login",

        "method": "post"

    },

    "headers": {

        "content-Type": "application/json"

    },

    "request": {

        "json": {

            "keywords": "13012349900",

            "password": "test123"

        }

    },

    "setup_script": "",  # setup script(option)

    "teardown_script": ""  # teardown_script(option)

}

format 2: single test scene(multiple test cases)


test_suites = {

    "name": "Test Suite 1",

    "cases": [

        {

            "title": "Login Interface",

            "interface": {"url": "/member/public/login", "method": "post"},

            "headers": {

                "Content-Type": "application/x-www-form-urlencoded",

                "Token": "${token}"  # quato envs

            },

            "request": {

                "params": {},

                "data": {"keywords": "13012349900", "password": "test123", "user2": "${username}"},

                "json": {"keywords": "13012349900", "password": "test123", "user2": "${username}"}

            },

            "setup_script": "",

            "teardown_script": ""

        },

        # more cases....

    ]

}

format 3: multiple test scenes


test_suites = [

    {

        "name": "Test Suite 1",

        "cases": [

            # case1

        ]

    },

    {

        "name": "Test Suite 2",

        "cases": [

            # case2

        ]

    }

]

License

MIT

Author

Shawn

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

api_engine_xin-0.0.13.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

api_engine_xin-0.0.13-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file api_engine_xin-0.0.13.tar.gz.

File metadata

  • Download URL: api_engine_xin-0.0.13.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for api_engine_xin-0.0.13.tar.gz
Algorithm Hash digest
SHA256 1739e0124fe4f2576b4f6dc01813a82b5f2d9a3a67cdd3b1fdaf7caed0c9962d
MD5 3e5cc387346cd57339889e878bf64770
BLAKE2b-256 d822d0e699b7d30c52dbcc48168fca4550e1b12fdd9716942880b57ba11b135d

See more details on using hashes here.

File details

Details for the file api_engine_xin-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for api_engine_xin-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 e87b3280526c8f56ab776ea4d9a55a8f457bdf0f9dc62ef1e5477503e11bea4d
MD5 f18ace64fb3278314dd297f84797bb8e
BLAKE2b-256 d2f2404e66c1b4dd4fc201afe326ae5252cc5500997a820301f88916b2eb6a9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page