nwave-ai/nwave/nw-test-organization-conventions
Claude Code and agent skill by nwave-ai/nwave
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Test directory structure patterns by architecture style, language conventions, naming rules, and fixture placement. Decision tree for selecting test organization strategy.
Install
npx vskill@latest install nwave-ai/nwave/nw-test-organization-conventionsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as nwave-ai/nwave/nw-test-organization-conventions.
Test Organization Conventions
Core Principle
Test directory structure encodes architectural boundaries. If a developer cannot infer the architecture from the test tree alone, the organization is wrong.
Architecture-to-Organization Decision Tree
Comparative Summary
| Architecture | Primary Axis | Secondary Axis | Unique Test Types | Co-located? | |
|---|---|---|---|---|---|
| Hexagonal | Test type | Domain concept | Port contract | No | |
| Clean | Test type | Architecture ring | Gateway | No | |
| Layered | Mirror source | Test type | Layer boundary | No (Java: yes) | |
| Vertical Slice | Feature | Test type | Cross-slice | Yes | |
| Modular Monolith | Module | Test type | Architecture, inter-module | No | |
| Microservices | Per-service | Test type | Contract (Pact) | No | |
| Event-Driven | Test type | Event flow role | Schema, idempotency, saga | No | |
| CQRS | Command/Query | Test type | Projection | No | |
| DDD | Bounded context | Building block | Aggregate, cross-context | No |
Mirror vs. Feature vs. Hybrid
| Strategy | Best For | Strengths | Weaknesses | |
|---|---|---|---|---|
| Mirror source | Layered, Clean, Hexagonal | Predictable paths, IDE navigation, package-private access (Java) | Feature changes touch multiple dirs | |
| Feature co-located | Vertical Slice, React | All feature code in one place, team ownership | Cross-feature tests homeless, hard to run by tier | |
| Hybrid (recommended) | Most projects | Type-first for CI stages, feature-nested within | Slightly deeper nesting |
Hybrid pattern (type-first, then feature within):
Language-Specific Conventions
The table is illustrative, not a closed discovery allowlist. Follow actual manifest/build/test targets under nw-test-design-mandates, including Dune test/tests/alias stanzas, .ml and relevant .mli/opam dependencies in an OCaml project. Incumbent native layouts/helpers win; no .py, Gherkin, tests/common or compulsory adapter registration is inferred from this table.
| Language | File Convention | Discovery Rule | Co-located? | |
|---|---|---|---|---|
| Python (pytest) | test_*.py or *_test.py | Prefix/suffix match | Separate tests/ (recommended) or inlined | |
| TypeScript/JS (Jest) | *.test.ts, *.spec.ts, __tests__/*.ts | testMatch pattern | Either | |
| Java (JUnit/Maven) | *Test.java in mirrored package | src/test/java mirrors src/main/java | Mirrored packages | |
| Go | *_test.go in same directory | Language-enforced co-location | Always co-located | |
| C# (xUnit/NUnit) | *Tests.cs in parallel project | Separate test project | Separate project | |
| Rust | #[cfg(test)] mod tests inline + tests/ | Inline for unit, tests/ for integration | Unit: inline, Integration: separate |
Python conftest.py Placement
Place conftest.py at the lowest directory where fixtures apply. Pytest discovers from outermost to innermost, enabling hierarchical fixture scoping:
BDD Feature Files
Organize step definitions by domain concept, not by feature file. Shared steps across features prevent duplication.
Hexagonal Architecture Test Tiers
| Tier | Location | Tests | Adapters | |
|---|---|---|---|---|
| Unit | tests/unit/ | Domain model, value objects, service layer | None (pure) or mock driven ports | |
| Integration | tests/integration/ | Individual adapters against real infra | Real infrastructure | |
| Acceptance | tests/acceptance/ | Use cases through driving ports | In-memory adapters | |
| E2E | tests/e2e/ | Full stack through HTTP/CLI | Real adapters |
Port contract tests: when multiple adapters implement one driven port, create shared contract test suite and run against each adapter.
Fixture Organization
| Scope | What | Placement | |
|---|---|---|---|
| Session | Expensive setup (DB engine, app) | Root conftest.py | |
| Module | Schema creation, service containers | Directory conftest.py | |
| Function | Data cleanup, test isolation | autouse=True in conftest.py | |
| Shared across types | Factories, builders | tests/conftest.py or tests/fixtures/ |
Anti-Patterns
| Anti-Pattern | Why It Fails | Fix | |
|---|---|---|---|
| Flat tests/ with no structure | Cannot run by tier, no boundary visibility | Organize by primary axis of architecture | |
| Mirroring hex layers in test tree | Couples tests to implementation structure | Organize by test type, not source structure | |
| Acceptance tests alongside E2E | Acceptance should use in-memory adapters and run fast | Separate: acceptance/ (fast) vs e2e/ (slow) | |
| Feature-coupled step definitions | Steps for login.feature only usable there | Organize steps by domain concept | |
| Mixing test tiers in one directory | Cannot run unit-only in pre-commit | Separate directories per tier | |
| Cross-module imports in tests | Violates module boundaries | Use inter-module tests with event bus | |
| E2E inside single microservice | They span services by definition | Move to separate e2e-tests/ project | |
| No contract tests between services | Mocks drift from reality | Consumer-driven contract tests (Pact) | |
Process metadata in the test file name (test_slice_01_*, test_slice_02_*) | The name outlives the scheduling decision and says nothing about protected behavior | Name the file after what it VERIFIES (test_shared_git_worktree_refusal.py), never after the delivery segment that authored it. Scheduling metadata is not a durable test identity. |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingnWave/skills/nw-test-organization-conventions/SKILL.md
Popularity
- Repository stars
- 568
- Repository forks
- 57
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/nwave-ai/nwave/nw-test-organization-conventions)