← 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 · ★ 9 · 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. ## When to Use - Adding a unit test for new logic (all new logic needs one) - A test fails with a timeout, or a unit test tries to open a socket - The user says "write a test" / "add tests" / "fix the failing test" - Reviewing tests before a commit or PR ## 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