Skip to main content

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:

  1. Quality Gates:
    • TypeScript compilation check (pnpm typecheck)
    • Linting (pnpm lint)
    • Formatting check (pnpm format --check)
  2. Security Audit:
    • Runs pnpm audit --prod to check for vulnerabilities.
  3. Testing:
    • Runs Japa tests (pnpm test) with MySQL and Redis service containers.
  4. Build Verification:
    • Compiles the project (pnpm build) to ensure it is deployable.

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.