Testing & Quality Assurance
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Testing and Quality Assurance (QA) within the Tuturuuu platform is a multi-layered discipline designed to ensure the reliability, performance, and maintainability of a complex monorepo. The strategy encompasses strict Test-Driven Development (TDD) workflows, automated Continuous Integration (CI) pipelines, and manual verification protocols. It spans multiple environments, including web (Next.js), mobile (Flutter), and service-specific modules like Discord bots and AI chat routes.
The primary objective is to maintain high code standards, specifically targeting >80% code coverage for all modules and enforcing unified verification commands before code is considered "done." This structured approach ensures that every feature, from AI model streaming to database migrations, undergoes rigorous validation across different platforms and user scenarios.
Sources: conductor/workflow.md:4-5, GEMINI.md:38-42, conductor/archive/maintenance_20251220/spec.md:7-13
TDD & Development Workflow
The core of the project's quality strategy is a strict TDD lifecycle enforced by the "Conductor" workflow. This process ensures that code is not only functional but inherently testable.
Standard Task Lifecycle
The workflow follows a Red-Green-Refactor pattern:
- Red Phase: Write failing unit tests that define expected behavior before any implementation.
- Green Phase: Implement the minimum code required to pass the tests.
- Refactor Phase: Improve code quality and performance while ensuring tests remain passing.
- Coverage Verification: Run language-specific coverage reports (e.g.,
vitest --coveragefor web orpytest --covfor Python) to ensure new code meets the >80% threshold.
Sources: conductor/workflow.md:12-32, conductor/archive/maintenance_20251220/plan.md:33-35
Task Verification Flow
The following diagram illustrates the lifecycle of a single task from selection to completion:
The diagram shows the iterative nature of the TDD cycle required for every task.
Sources: conductor/workflow.md:12-42
Testing Layers & Environment Specifics
Web & Monorepo Testing
The web application and shared packages utilize Vitest for unit and integration testing. Verification is unified through specific commands that must be executed at the end of every development session.
| Category | Command | Scope |
|---|---|---|
| Unified Check | bun check | Runs formatting, tests, type-checking, and i18n checks. |
| Type Checking | bun type-check | Monorepo-wide TypeScript validation. |
| Unit Testing | bun test | Executes all Vitest suites across packages and apps. |
| Formatting | bun format-and-lint:fix | Biome-based linting and formatting. |
Sources: GEMINI.md:38-45, GEMINI.md:72-74
Mobile (Flutter) Testing
Mobile quality assurance focuses on Dart-specific tools and responsive behavior.
- Verification: The command
bun check:mobileis mandatory for changes toapps/mobile/. It executesdart format,flutter analyze, andflutter test. - Widget Testing: Specifically for
shadcn_fluttercomponents, tests must wrap widgets inShadcnAppwith proper localization delegates to resolve themes correctly. - Manual Checks: Includes testing touch interactions (44x44px targets), responsive layouts, and performance on 3G/4G networks.
Sources: GEMINI.md:43-45, GEMINI.md:52-54, conductor/workflow.md:144-149
Discord Bot (Python) Testing
The Discord service uses pytest and ruff for its quality gate.
# Discord test execution
pytest --cov=. --cov-report=term-missing
ruff check .
mypy .
Sources: apps/discord/TESTING.md:13-28
Phase Completion & Checkpointing
When a project phase is concluded, a specific "Checkpointing Protocol" is triggered to ensure cumulative quality.
- Scope Determination: Identify all files changed since the last checkpoint using
git diff. - Missing Test Detection: Ensure every code file changed has a corresponding test file.
- Automated Suite Execution: Run the full suite (Type checks + Tests) with
CI=true. - Manual Verification Plan: Generate a step-by-step plan for the user to verify user-facing goals.
- Audit Report: Attach a detailed verification report to the checkpoint commit using
git notes.
Sources: conductor/workflow.md:52-110
Phase Verification Sequence
This sequence diagram shows the interaction between the developer (Agent) and the user during a phase checkpoint.
The diagram outlines the mandatory interaction and validation steps required at the end of a project phase.
Sources: conductor/workflow.md:52-101
Definition of Done (DoD)
A task or feature is only considered "Done" when it passes the following quality gates:
- Functional: Code implemented to specification and works on mobile (if applicable).
- Tested: Unit tests passing with >80% coverage.
- Safe: Type checks pass, linting/static analysis is clean, and no hardcoded secrets are present.
- Documented: Public functions/methods are documented via JSDoc/docstrings and implementation notes added to
plan.md. - Verified: Final verification via
bun checkorbun check:mobile.
Sources: conductor/workflow.md:173-182, GEMINI.md:41-45
Summary
The Testing & Quality Assurance framework at Tuturuuu is a comprehensive system that prioritizes automated verification and TDD. By mandating >80% coverage, enforcing unified check commands for web and mobile, and requiring detailed manual verification plans for every phase, the project ensures that high standards are maintained across its diverse monorepo architecture. This rigor minimizes regressions and guarantees that features like the "Smart Scheduling Algorithm" and "AI Chat" routes are robust and production-ready.