DRN Testing Overview
DTT favors honest feedback with the least necessary test machinery. drn-testing owns data attributes and contexts.
DTT Principles
| Principle | Practice |
|---|---|
| Security first | Avoid leaking secrets in fixtures, logs, snapshots, and generated data |
| Correctness over speed | Prefer real dependencies when mocks would hide behavior |
| Clarity over cleverness | One readable flow beats many tiny duplicate tests |
| Simplicity | Use [Fact] when no data, generation, or context is needed |
| Performance with proof | Benchmark only when a performance question is explicit |
Test Type Selection
| Change | Default test type | Why |
|---|---|---|
| Pure utility, domain invariant, deterministic logic | Unit | Use DataInlineUnit when data/generation helps |
| Attribute DI registration or isolated service behavior | Unit | DrnTestContextUnit validates wiring without Docker |
| Repository, EF mapping, query, transaction, concurrency | Integration DB | Real PostgreSQL is the useful signal |
| Controller, endpoint, auth, middleware, serialization | API integration | Full request pipeline via ApplicationContext |
| External HTTP client behavior | Integration/API | Use FlurlHttpTest against outbound URL patterns |
| Throughput, allocation, latency, load | Performance | BenchmarkDotNet/K6 only with explicit user intent |
Project Shape
Resolve project names and paths from the current repository profile or filesystem. These are test roles, not required folder names:
| Role | Coverage |
|---|---|
| Unit | Isolated logic and service validation |
| Analyzer, when present | Roslyn analyzer regression tests |
| Integration | Testcontainers, repositories, API/E2E |
| Performance, when present | BenchmarkDotNet and K6 |
Routing
- Need exact attribute/context rules or MTP commands: drn-testing
- Writing isolated tests: test-unit
- Choosing API vs DB integration: test-integration
- Endpoint behavior: test-integration-api
- Repository/database behavior: test-integration-db
- Performance work: test-performance