api-scenario-runner Executes Full Business-Chain API Tests with Three-Level Assertions and CI-Ready Compilation
End-to-end API testing now has an AI-driven path that treats a whole business flow as the unit under test, not isolated endpoints. That means fewer surprises in production where every endpoint works but the checkout still fails, and it turns scenario definitions into executable, CI-friendly pytest code.
All the single-interface tests can pass while the business flow still breaks. api-scenario-runner closes that gap by treating the whole chain from registration to order query as one test scenario. It reads a scenario YAML file, sends requests in sequence, auto-extracts and injects variables, and adds Bearer token headers where needed.
Assertions run at three levels: status code, business code, and JSONPath, plus a terminal DB state check that only allows SELECT with parameterized SQL. Failure stops execution and a snapshot file records the real request, response, and variables after injection, with sensitive values masked. Failures classify into five categories: missing variable, assertion failure, API error, connection error, and DB error.
Two execution modes exist: direct run and compile to a pytest project. Compiled scripts drop into the existing test hierarchy, schedule through api-test-executor, and feed a pipeline that includes cleanup and reporting. A dedicated idempotency round proves a second run goes green without changes, thanks to dynamic timestamp usernames and proper data cleanup, separating CI-viable tests from flaky ones.
Moving from single-interface tests to whole business chains catches integration failures that unit-style API tests miss, like a token that doesn't propagate from login to order.
The idempotency round is the real gate for CI adoption; most test suites fail on repeated runs due to state pollution, and dynamic data plus cleanup is the solution.
Compiling scenario YAML to pytest bridges declarative AI-driven test design with existing test infrastructure, letting teams adopt the approach without abandoning their current runners and reporters.