Skip to content

Document the Testing Strategy and Test Layers #2138

Closed

Description

@josecelano

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.md as 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.md covers 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.md links to the guide.
  • The guide does not establish duplicate or conflicting policy sources.
  • linter all and 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:

  1. Compare each guide row with its linked AGENTS.md, skill, workflow, ADR, and representative example.
  2. Follow the docs/index.md link and inspect all guide references.
  3. Verify that the guide links detailed procedures rather than duplicating them.
  4. Confirm the strategy and history accurately reflect maintainer input and tests/AGENTS.md.

References

Activity

  1. self-assigned this
    on Sep 4, 2026
  2. added 2 commits that reference this issue on Sep 4, 2026
  3. added 4 commits that reference this issue on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions