Integration test

From IntentArchitect/Intent.Modules.NET · View interactive version

Integration test is an AI agent skill from the GitHub repository IntentArchitect/Intent.Modules.NET. Implement or extend black-box HTTP integration tests for the solution's API, following this codebase's established testing conventions. Use when integration test classes are empty, incomplete, or failing, or when new endpoints need coverage.

How to use this skill

Skill file

API Integration Tests

Implement integration tests that exercise the API end-to-end over HTTP, against the real application host and a real database. Favor testing the observable HTTP contract, self-contained arrangement through the API, and deterministic isolation over shortcuts that couple tests to implementation details.

The generated test project typically already contains the host plumbing: a WebApplicationFactory subclass, a database fixture, a shared collection fixture, a BaseIntegrationTest exposing CreateClient(), and one empty test class per endpoint (marked for merge). Populate those test classes in place; add reusable helpers as new, non-generated files.

Core rules

Workflow

  1. Inspect the generated test project: the WebApplicationFactory, the database/container fixture, the shared collection fixture, BaseIntegrationTest, and the empty per-endpoint test classes. Confirm what is already wired up.
  2. Enumerate the endpoints. For each, run the per-endpoint discovery checklist below.
  3. Build a small, self-contained harness as new files (only what's missing): HTTP send/read helpers that never throw on non-success, optional scoped database access, a unique-token generator, and per-slice test-data builders that arrange preconditions through the API.
  4. Implement each endpoint's test class: one happy path plus the meaningful edge cases surfaced during discovery (validation → 400, not-found, route/body id conflicts, forbidden/unauthorized, enum/paging bounds).
  5. Compile, then RUN the suite against the container. Read the actual status codes and bodies.
  6. Stabilise: where an assertion’s expectation differs from observed behaviour, investigate the cause. If it is your test’s mistake, fix the test; if it is the API’s behaviour, assert the observed value, comment it, and add it to findings.
  7. Re-run until green. Report the pass count and the findings list.

Per-endpoint discovery checklist

For each endpoint, extract and note:

Test isolation guidance

The test database is normally shared across the whole test collection and is NOT reset between tests, so tests must not assume an empty or fixed dataset.

Findings report guidance

While writing the tests you will discover real defects and surprises. Do not silently encode a "should be" that fails, and do not hide them. Instead:

HTTP client guidance

WebApplicationFactory host guidance

Testcontainers database guidance

Validation guidance

JSON & enum serialization guidance

Relational / foreign-key guidance

Assertion & test-library guidance

Output expectations

Produce concrete test code that:

Review checklist

Before finishing, check that:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.