CI / CI configuration security checks (push) Successful in 3s
CI / Capabilities and shell quality (push) Successful in 14s
CI / Python tests and compilation (push) Successful in 26s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 14s
CI / PowerShell tests on Ubuntu (push) Successful in 1m4s
CI / Installed client configuration smoke tests (push) Successful in 33s
CI / Bash integration and installation guards (push) Successful in 1m1s
22 lines
2.8 KiB
Markdown
22 lines
2.8 KiB
Markdown
---
|
|
name: integration-test-write
|
|
description: Use when adding or changing tests for behavior across a real boundary, such as an API and database, filesystem command, or cooperating services. Not for isolated units or UI-driven tests.
|
|
---
|
|
|
|
# Integration Test Write
|
|
|
|
Use when verifying behavior across a real application boundary, such as an API and database, a command and filesystem, or cooperating services. When Superpowers `test-driven-development` applies, it sets the order (failing test first); this skill decides the boundary, fixtures, and isolation.
|
|
|
|
## Workflow
|
|
|
|
1. Name the boundary under test and the production path the test must exercise. Keep unit-level details covered by unit tests.
|
|
2. Reuse the repository's integration-test setup. Before relying on external service, driver, or test-framework behavior, MUST apply the implementation checkpoint in `technical-research`. Start only the services and data stores required for this behavior.
|
|
3. Test against the real engine the application uses, started per run in a container (for example with Testcontainers) or as a dedicated test instance. Do not use the EF Core in-memory provider as a database fake: EF Core discourages it because it skips relational behavior such as constraints, transactions, raw SQL, and query translation. SQLite in-memory is closer but still differs from the production engine; use it only where those differences cannot matter. For ASP.NET Core, host the app with `WebApplicationFactory` and replace only external dependencies through `ConfigureTestServices`.
|
|
4. Prepare minimal isolated data and control external inputs. Use synthetic, non-personal test data; never copy production or personal records. Prevent test runs from touching user data, shared environments, or live services. For third-party APIs, use the provider's sandbox or test mode, or contract tests, and report the gap that remains against the live provider.
|
|
5. Cover a successful interaction and the failure or rejection path that matters to the change. Include transaction, retry, or cleanup behavior only when it is part of the contract.
|
|
6. Assert persisted or externally observable outcomes, including relevant status, response, and side effects.
|
|
7. Isolate tests: wrap each test in a transaction that is rolled back, or reset the data between tests; tests whose code manages its own transactions need a separate database and must not run in parallel. Clean up created resources even when assertions fail, and make repeated runs safe and independent.
|
|
8. Run the focused integration test and report required services, results, and any unavailable environment. MUST apply the verification checkpoint in `technical-research` to external contract claims; a mock or documentation excerpt cannot prove the real boundary works.
|
|
|
|
Avoid turning an integration test into a full end-to-end suite when a narrower boundary proves the contract.
|