接口测试平台测试用例执行引擎
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
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
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
File details
Details for the file api_engine_xin-0.0.15.tar.gz.
File metadata
- Download URL: api_engine_xin-0.0.15.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b43f9ddc172c0275011ecdc2988269e5c92b807ca1709a0c780cb2983bb3ebaa
|
|
| MD5 |
ef4c26b4d99d316ec67ad0f2529ea591
|
|
| BLAKE2b-256 |
150094ccb96dc33adf1c20b926a598aadf6b1832c9b6bfbb1ce70197e379e7a5
|
File details
Details for the file api_engine_xin-0.0.15-py3-none-any.whl.
File metadata
- Download URL: api_engine_xin-0.0.15-py3-none-any.whl
- Upload date:
- Size: 12.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
910db8d58f83fa0dd638af144115315e9f2ad5eef83c793e0ded794e5aeaad4f
|
|
| MD5 |
c38e9ce736cc280318b3238e8a95f5b0
|
|
| BLAKE2b-256 |
c4e84f68397548c55bff367e855ca44950b0a4e5de267bf0ece2d163d0b1e83d
|