← ClaudeAtlas

testing-conventionslisted

Write tests that pass this repo's enforced testing rules (Surefire 5s timeout, network-off unit tests, ArchUnit conventions, JUnit 5 only). Use when adding or changing tests, when a test times out or opens a network connection, or when the user says "write a test", "add tests", or "fix the failing test".
adamw7/tools · ★ 11 · Testing & QA · score 74
Install: claude install-skill adamw7/tools
# Testing Conventions Skill Write unit and integration tests that satisfy the `tools` repo's enforced testing rules the first time. These rules are enforced by Surefire config, JUnit extensions, and ArchUnit architecture tests — a test that ignores them fails the build, not just review. ## Hard rules (build fails otherwise) ### Timeouts - **5 s per unit test.** Surefire enforces a 5-second per-test timeout (root `pom.xml`). The bound is generous because the reactor builds in parallel (`-T1C`) and contending test forks stretch the cold-fork warmup; it is *not* a budget to spend. Keep unit tests fast — no real I/O, no sleeps, no heavy loops. A genuinely heavier test opts out with an explicit `@Timeout` **and a comment explaining why**. - Heavy shared setup (`@BeforeAll` etc.) has a looser 10-second limit (15 s under coverage). A fork that hangs outright is killed at 300 s (`forkedProcessTimeoutInSeconds`). ### Network is off for unit tests - The `data` module's `NetworkOffExtension` engages the `Switch` kill-switch before any test runs, so a unit test **cannot** open an outbound connection. - Anything needing the network is an integration test (`*IT`), gated behind the `integration-tests` profile and run by Failsafe — not Surefire. ### Test conventions pinned by `TestConventionsArchitectureTest` - Test methods live only in `*Test` / `*IT` classes. - **JUnit 5 only** (`org.junit.jupiter`). No JUnit 4. - No `@Disabled`. - No `System.out` / `System.err` in t