← ClaudeAtlas

test-stylelisted

The testing style for a Java project - how tests are named, what each of the three levels (UT/IT/CT) is responsible for, what may be mocked and what may not, and what has to be asserted at each level. Load it before writing or rewriting a test, and whenever judging whether an existing test still follows the house style. The procedure for bringing a module's tests back to green after a refactor is the separate `test-refactor` skill.
dmitriy-iliyov/claude-skills · ★ 0 · Testing & QA · score 72
Install: claude install-skill dmitriy-iliyov/claude-skills
# Test style House rules for `src/test`. A test class that breaks one of them is either wrong, or a reason to change the rule here deliberately. Code, javadoc and message text are written in English. ## The three levels | Level | File suffix | `@DisplayName` prefix | What is alive | What is stubbed | |---|---|---|---|---| | Unit | `*UnitTest` | `UT` | one class | all of its collaborators | | Integration | `*IntegrationTest` | `IT` | the Spring context, or a real Postgres/Redis in a container | everything not under test | | Component | `*ComponentTest` | `CT` | the whole module | only other modules | **UT** is about the contract of a single class. No Spring context; collaborators are Mockito mocks. **IT** is for what a UT cannot reach, and it comes in two flavours that share the suffix and little else: - **IT of an autoconfiguration** - the composition of the Spring context, run on `ApplicationContextRunner` or `WebApplicationContextRunner`. Nothing external is alive; the beans this particular test does not assert on are mocks. - **IT against a real external system** - the classical integration test, and the one a module that owns a store or a client is made of. Testcontainers brings up a real Postgres or a real Redis, and the test asserts that the implementation delivers the guarantees its interface promises - against the real engine rather than against a mock of it, because those guarantees (atomicity, a conditional write, what a `NULL` column reads back a