nwave-ai/nwave/nw-test-organization-conventions

Claude Code and agent skill by nwave-ai/nwave

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

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-conventions

Semi-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

What is the project's architectural style?
|
+-- Hexagonal / Clean Architecture
| --> Test-type-first: tests/{unit,integration,acceptance,e2e}/
| --> Domain concepts nested within each type
| --> Port contract tests in tests/integration/
|
+-- Vertical Slice
| --> Co-located: features/{slice}/tests/
| --> Cross-slice tests in top-level tests/cross_feature/
|
+-- Modular Monolith
| --> Module-first: tests/modules/{module}/{unit,integration}/
| --> Architecture tests per module (dependency rule enforcement)
| --> Inter-module tests in tests/inter_module/
|
+-- Microservices
| --> Per-service test tree: {service}/tests/{unit,integration,component,contract}/
| --> Contract tests: consumer writes in own repo, provider verifies in own repo
| --> Cross-service E2E in separate project: e2e-tests/
|
+-- Event-Driven
| --> Test-type-first with event-specific categories
| --> Unique: schema contract tests, idempotency tests, saga compensation tests
|
+-- CQRS
| --> Command/Query split within each test type
| --> Unique: projection tests (rebuild + idempotency)
|
+-- Layered (N-Tier)
| --> Mirror source: tests mirror src layer hierarchy
| --> Integration tests verify layer boundary contracts
|
+-- DDD (Tactical)
| --> Bounded-context-first: tests/{context}/domain/aggregates/
| --> Cross-context contract tests in tests/bounded_context_integration/

Comparative Summary

ArchitecturePrimary AxisSecondary AxisUnique Test TypesCo-located?
HexagonalTest typeDomain conceptPort contractNo
CleanTest typeArchitecture ringGatewayNo
LayeredMirror sourceTest typeLayer boundaryNo (Java: yes)
Vertical SliceFeatureTest typeCross-sliceYes
Modular MonolithModuleTest typeArchitecture, inter-moduleNo
MicroservicesPer-serviceTest typeContract (Pact)No
Event-DrivenTest typeEvent flow roleSchema, idempotency, sagaNo
CQRSCommand/QueryTest typeProjectionNo
DDDBounded contextBuilding blockAggregate, cross-contextNo

Mirror vs. Feature vs. Hybrid

StrategyBest ForStrengthsWeaknesses
Mirror sourceLayered, Clean, HexagonalPredictable paths, IDE navigation, package-private access (Java)Feature changes touch multiple dirs
Feature co-locatedVertical Slice, ReactAll feature code in one place, team ownershipCross-feature tests homeless, hard to run by tier
Hybrid (recommended)Most projectsType-first for CI stages, feature-nested withinSlightly deeper nesting

Hybrid pattern (type-first, then feature within):

tests/
unit/
features/
order/test_create_order.py
payment/test_process_payment.py
integration/
features/
order/test_order_repository.py
e2e/
test_checkout_flow.py

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.

LanguageFile ConventionDiscovery RuleCo-located?
Python (pytest)test_*.py or *_test.pyPrefix/suffix matchSeparate tests/ (recommended) or inlined
TypeScript/JS (Jest)*.test.ts, *.spec.ts, __tests__/*.tstestMatch patternEither
Java (JUnit/Maven)*Test.java in mirrored packagesrc/test/java mirrors src/main/javaMirrored packages
Go*_test.go in same directoryLanguage-enforced co-locationAlways co-located
C# (xUnit/NUnit)*Tests.cs in parallel projectSeparate test projectSeparate project
Rust#[cfg(test)] mod tests inline + tests/Inline for unit, tests/ for integrationUnit: 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:

tests/
conftest.py # Session fixtures: DB engine, app instance
unit/
conftest.py # Unit-specific: auto-mock markers
integration/
conftest.py # Integration: real DB fixtures
acceptance/
conftest.py # Acceptance: feature file paths
BDD Feature Files
tests/
features/ # Gherkin .feature files by domain
order/
place_order.feature
payment/
process_payment.feature
step_defs/ # Step implementations by domain concept
conftest.py
order_steps.py
payment_steps.py

Organize step definitions by domain concept, not by feature file. Shared steps across features prevent duplication.

Hexagonal Architecture Test Tiers

TierLocationTestsAdapters
Unittests/unit/Domain model, value objects, service layerNone (pure) or mock driven ports
Integrationtests/integration/Individual adapters against real infraReal infrastructure
Acceptancetests/acceptance/Use cases through driving portsIn-memory adapters
E2Etests/e2e/Full stack through HTTP/CLIReal adapters

Port contract tests: when multiple adapters implement one driven port, create shared contract test suite and run against each adapter.

tests/integration/
test_repository_contract.py # Abstract tests for RepositoryPort
test_postgres_repository.py # Runs contract against Postgres
test_inmemory_repository.py # Runs contract against in-memory

Fixture Organization

ScopeWhatPlacement
SessionExpensive setup (DB engine, app)Root conftest.py
ModuleSchema creation, service containersDirectory conftest.py
FunctionData cleanup, test isolationautouse=True in conftest.py
Shared across typesFactories, builderstests/conftest.py or tests/fixtures/

Anti-Patterns

Anti-PatternWhy It FailsFix
Flat tests/ with no structureCannot run by tier, no boundary visibilityOrganize by primary axis of architecture
Mirroring hex layers in test treeCouples tests to implementation structureOrganize by test type, not source structure
Acceptance tests alongside E2EAcceptance should use in-memory adapters and run fastSeparate: acceptance/ (fast) vs e2e/ (slow)
Feature-coupled step definitionsSteps for login.feature only usable thereOrganize steps by domain concept
Mixing test tiers in one directoryCannot run unit-only in pre-commitSeparate directories per tier
Cross-module imports in testsViolates module boundariesUse inter-module tests with event bus
E2E inside single microserviceThey span services by definitionMove to separate e2e-tests/ project
No contract tests between servicesMocks drift from realityConsumer-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 behaviorName 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/nwave-ai/nwave/nw-test-organization-conventions/badge)](https://verified-skill.com/skills/nwave-ai/nwave/nw-test-organization-conventions)

Something wrong with this skill or its page? Tell us.