drafael/coding-harness / skills/write-tests
write-tests
VerifiedWrite unit, integration, component, and end-to-end tests for code. Use when the user asks to "write tests", "add tests", "add test coverage", or "create test cases" for functions, services, components, CLIs, or user flows.
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 1.3 KB |
| SKILL.md | skill md | 3.6 KB |
| references/bun-test.md | markdown | 4.5 KB |
| references/jest.md | markdown | 4.7 KB |
| references/junit.md | markdown | 1.6 KB |
| references/node-test.md | markdown | 4.1 KB |
| references/playwright.md | markdown | 5.7 KB |
| references/typescript.md | markdown | 5.7 KB |
| references/vitest.md | markdown | 4.4 KB |
references/junit.md
View on GitHub
## JUnit
Use the **java-coder** skill, but the instructions from this file take precedence over it for writing tests only
**Assertions**
- Always use AssertJ — never raw JUnit assertions
**Imports**
- Always use **static imports** for static methods, including but not limited to:
- `org.assertj.core.api.Assertions.assertThat`, `org.assertj.core.api.Assertions.assertThatThrownBy`
- `org.mockito.ArgumentMatchers.any`, `org.mockito.ArgumentMatchers.eq`
- `org.mockito.Mockito.mock`, `org.mockito.Mockito.spy`, `org.mockito.Mockito.when`, `org.mockito.Mockito.verify`
- `org.mockito.Mockito.doReturn`, `org.mockito.Mockito.doThrow`
**Naming**
- Test methods: `{methodName}_{precondition}_{expectedOutcome}`
- `@DisplayName`: human-readable sentence describing the scenario; never echo the method name
- The instance of the class under test: always `subject`
**Structure**
- Prefer straight-line test-case bodies: split scenarios when parameters select different actions or assertion paths. Retain parameterization when flow and assertions remain uniform.
- Conditions needed for cleanup, polling, or synchronization helpers are allowed; this is not a blanket ban on conditional syntax.
- Prefer `@InjectMocks` over constructing the tested class manually in `@BeforeEach`
- Prefer `var` for locals initialized by a constructor or builder call
- Extract expected values into named constants only when they appear in multiple test cases; inline single-use values
**Scope**
- Only test business logic and services — never write tests for JPA/Hibernate entities, DTOs, `@Configuration` beans, or Spring Data repositories
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |