# api_test **Repository Path**: YunAbove/api_test ## Basic Information - **Project Name**: api_test - **Description**: 基于Python和pytest的广告账户API自动化测试框架,采用数据驱动设计,集成数据库操作、日志记录及Allure报告,支持参数化测试与CI/CD无缝集成,助力高效接口测试与质量保障。 - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-08-29 - **Last Updated**: 2026-09-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Nexus-Testing **Scenario-driven intelligent testing engine for the Nexus AI Testing Platform.** > Nexus-Testing is the open-source testing core of the Nexus platform, evolved from the api_test project > (v1.4.0-security-clean-final baseline). It turns test scenarios into **declarative YAML contracts** > executed by a registry-driven engine — no test-code generation required. --- ## Overview Nexus-Testing is a pytest-based testing engine that separates **what to test** (Scenario YAML) from **how to test** (Fixtures/Executors/Assertions). It ships with: - **Scenario Protocol v0.1** — a stable contract between AI agents and the testing engine - **YAML-driven testing** — scenarios declared as data, not code - **Dynamic Fixtures** — test data/file/business-state generated at runtime - **Business Flow Fixtures** — real business workflows (e.g. copy-apply → media review) - **Scenario Assembler + Registries** — pluggable, zero-branch orchestration - **API execution engine** — upload/request + assertion pipeline ## Features | Feature | Description | |---|---| | Scenario Protocol v0.1 | Schema-validated YAML contract (`version/name/flow/fixtures/actions/assertions`) | | YAML driven testing | `scenarios/*.yaml` → runner, no Python test code per scenario | | Dynamic Fixture | `ExcelFixtureGenerator` — runtime file generation (no static attachments) | | Business Flow Fixture | `CopyApplyFlowFixture` — self-made apply flows via real open-API chain | | ScenarioAssembler | Assembles flow + fixtures from scenario definitions | | Registry architecture | Flow/Fixture/Action/Assertion registries — extend by registration | | API execution engine | Upload/request execution with HTTP + JSON-path assertions | | CLI Runner | `python -m scenario.runner ` | ## Architecture ``` Scenario YAML (Protocol v0.1) ↓ Scenario Runner (CLI / python API) ↓ Scenario Assembler ↓ ┌────────────────┴────────────────┐ ↓ ↓ Flow Registry Fixture Registry (CopyApplyFlowFixture) (ExcelFixtureGenerator) ↓ ↓ ┌────────────────────────────┘ ↓ Action Registry (API executor) ↓ Assertion Registry (http / response / database) ↓ PASS / FAIL result ``` ## Quick Start ```bash # 1. Clone git clone https://github.com/Abovetheclouds306/Nexus-Testing.git cd Nexus-Testing # 2. Install & init (creates .env / users.yaml / runtime dirs from templates) python init.py # 3. Configure environment # Edit .env — set API_BASE_URL, credentials, etc. (see .env.example) # 4. Run scenarios (requires a reachable test environment) python -m scenario.runner media_review_success # 5. Run the test suite pytest -m smoke -v ``` ## Project Structure ``` Nexus-Testing/ ├── scenario/ # Scenario protocol layer │ ├── schema/ # v0.1 schema + validator + agent templates │ ├── registry/ # Flow/Fixture/Action/Assertion registries │ ├── scenario_loader.py # YAML → Scenario object (legacy compatible) │ ├── scenario_assembler.py # orchestration (no if-branches) │ ├── scenario_runner.py # execution entry │ └── runner.py # CLI entry (python -m scenario.runner) ├── scenarios/ # Declarative scenario YAMLs ├── fixtures/ # (evolving) fixture layer home ├── utils/ # TestDataFactory / ExcelFixtureGenerator / │ # CopyApplyFlowFixture / ReviewTaskFixture ... ├── tests/ # pytest suite (incl. scenario protocol tests) ├── config/ # endpoints + env-driven configuration ├── test_data/ # data-driven test parameters (environment data) └── init.py # one-click initialization ``` > Historical layout from api_test is preserved; `utils/` currently hosts the fixture layer > that will graduate into `fixtures/` in a future release. ## Roadmap - **UI Adapter** — Playwright executor for UI scenarios (Nexus-Console) - **Performance Adapter** — load/performance scenario execution - **Nexus-Agent integration** — AI agent generates scenario YAML directly - **Nexus-Console integration** — unified execution across adapters - **database assertions** — replace v0.1 stub with real DB checks ## Docs - [Scenario Protocol v0.1](docs/protocol/SCENARIO_PROTOCOL_V0.1.md) - [Nexus-Testing Architecture](docs/architecture/NEXUS_TESTING_ARCHITECTURE.md) ## License AGPL-3.0