Repository navigation
Description
Goal
Add a concise, human-facing testing strategy guide that explains Torrust Tracker's test types, why each layer exists, the evidence it provides, and where to find representative examples and authoritative procedures.
The guide must improve discovery without duplicating detailed instructions owned by scoped AGENTS.md files, skills, scripts, CI workflows, ADRs, or package READMEs.
Related to #1347.
Background
Testing knowledge is distributed across repository instructions, package and root integration-test guidance, specialized skills, CI workflows, ADRs, package READMEs, and issue-local test plans. Contributors need one entry point for selecting an appropriate test layer, understanding each layer's guarantees and limits, and finding the correct examples and procedures.
The project had no automated tests roughly three years ago. E2E tests were introduced first because they could be added without restructuring the code. The codebase has since been refactored into workspace packages to enable unit and package-level integration tests. The guide should make clear that the direction is toward lower-level tests, rather than simply adding E2E coverage.
Scope
In scope
- Create
docs/testing.mdas the entry point for the testing strategy. - Describe unit and documentation tests; in-process package integration tests; in-process root application integration tests; executable-boundary integration tests; container E2E tests; container-plus-qBittorrent E2E tests including database compatibility; manual verification; and the distinction between tests, benchmarks, and profiling.
- State the strategy: prefer unit tests, test as close to code as possible, reserve root-level integration tests for multi-service orchestration, and treat E2E as the outermost safety net.
- For each layer, explain when to use it, what it proves, a meaningful limitation, a representative example, and an authoritative detailed source.
- Explain validation ownership among focused local checks, pre-commit, pre-push, CI merge authority, and manual verification.
- Add a navigational link from
docs/index.md. - Correct only small, factual, directly related documentation issues found during validation; record broader work as follow-up issues.
Out of scope
- Rewriting existing scoped guidance into
docs/testing.md. - Changing test behavior, Cargo test-target configuration, fixtures, CI workflows, hook scripts, coverage thresholds, container images, or database matrices.
- Mandating a fixed test count or changing the risk-based test-gap policy.
- Creating a generic test framework, taxonomy library, or test-only crate.
Test taxonomy and strategy
- Unit tests: colocated with the package code they exercise.
- Integration tests: in-process tests calling functions below
main, either at package level or at root level through the application container; executable-boundary tests spawning the compiled tracker process to verify OS-level behavior such as signals. - E2E tests: container tests using project clients, and container tests driven by qBittorrent, both using runners in
packages/e2e-tools.
More unit tests are better. A test should be placed as close to the code as possible; package-level coverage is the primary growth target. Root-level tests belong only to multi-service behavior orchestrated by the application container, as described in tests/AGENTS.md. E2E tests verify packaged-artifact and real-client interoperability but are slower and less precise, so they are not the default layer.
Implementation notes
The guide should remain a navigation document, using relative links and preserving existing sources of truth for commands and procedures. It must not copy volatile command blocks maintained by skills, scripts, or workflows.
Before implementing the "Writing maintainable tests" section, check whether PR #2137 has merged. If it has, link docs/testing/refactoring-patterns/README.md as a source for test maintainability, readability, and expressiveness improvements. If it has not merged, do not block this issue or claim the catalog is available on develop; retain PR #2137 as a forthcoming related source.
Acceptance criteria
docs/testing.mdcovers all listed verification layers and distinguishes benchmarks/profiling from correctness tests.- The guide states the testing strategy and E2E-first history.
- Each layer explains use, proof, limitation, representative example, and authoritative source.
- The guide distinguishes focused checks, pre-commit, pre-push, CI merge authority, and manual verification without duplicating owned commands.
docs/index.mdlinks to the guide.- The guide does not establish duplicate or conflicting policy sources.
linter alland relevant documentation checks pass.- A reviewer can verify the guide's claims and links against current repository artifacts.
Verification
Automatic checks: linter markdown, linter cspell, linter all, and any available Markdown link/path validation.
Manual verification:
- Compare each guide row with its linked
AGENTS.md, skill, workflow, ADR, and representative example. - Follow the
docs/index.mdlink and inspect all guide references. - Verify that the guide links detailed procedures rather than duplicating them.
- Confirm the strategy and history accurately reflect maintainer input and
tests/AGENTS.md.
References
- Overhaul: Packages Testing #1347
- PR test(axum-http-server): strengthen package-local test coverage (#2136) #2137
tests/AGENTS.mdtests/lifecycle/native_tracker.rspackages/e2e-tools/README.md.github/skills/dev/testing/write-unit-test/SKILL.md.github/workflows/testing.yaml.github/workflows/container.yaml.github/workflows/db-compatibility.yamldocs/adrs/20260603000000_keep_unit_tests_inside_container_build.md
Activity
docs(issues): add issue specification for torrust#2138
Merge #2139: docs(issues): add testing strategy specification (#2138)
Merge torrust#2141: docs(testing): add testing strategy guide (torrus…
chore(issues): archive closed issue specs torrust#1586, torrust#1588, t…
chore(issues): archive closed issue specs torrust#1586, torrust#1588, t…
Merge #2207: chore(issues): archive closed issue specifications