Backend QA & Testing Strategy
This section outlines the testing strategy, workflows, and technologies used in the Control-Hub-Back repository.
π Technology Stackβ
- Framework: AdonisJS (Node.js)
- Language: TypeScript
- Database:
- MySQL (Primary)
- Redis (Cache & Session)
- Testing Framework: Japa
- Linting & Formatting: ESLint, Prettier
π§ͺ Testing Strategyβ
We use Japa for running both unit and functional tests.
Test Suitesβ
- Unit Tests: Located in
tests/unit. Focus on individual components, helpers, and isolated logic. - Functional Tests: Located in
tests/functional. Cover API endpoints, database interactions, and integration flows.
Running Testsβ
To run the tests locally:
pnpm test
This command executes node ace test.
π CI/CD Workflowsβ
The repository uses GitHub Actions for continuous integration and quality assurance.
1. CI Pipeline (ci.yml)β
Triggers on push and pull_request to master and dev.
Stages:
- Quality Gates:
- TypeScript compilation check (
pnpm typecheck) - Linting (
pnpm lint) - Formatting check (
pnpm format --check)
- TypeScript compilation check (
- Security Audit:
- Runs
pnpm audit --prodto check for vulnerabilities.
- Runs
- Testing:
- Runs Japa tests (
pnpm test) with MySQL and Redis service containers.
- Runs Japa tests (
- Build Verification:
- Compiles the project (
pnpm build) to ensure it is deployable.
- Compiles the project (
2. SonarQube Analysis (sonar.yml)β
Triggers on push and pull_request to main, dev, and master.
- Runs unit tests with coverage (
npx c8 ...). - Performs SonarQube scan for code quality and security analysis.
- Enforces Quality Gate checks.
βΏ Accessibilityβ
Not applicable for this backend service.