Skip to main content

Testing Strategy

Default CI Gate

CI should run tests with --build_tests_only so wildcard patterns do not fail on non-test build targets.

  • Monorepo non-deploy gate: .github/workflows/bazel-build.yml
  • Website deploy workflow tests: .github/workflows/cloudflare-workers.yml
  • Microservice deploy workflow tests: .github/workflows/gcp-deploy.yml
  • Android workflow tests: .github/workflows/android.yml

Example:

bazel test --build_tests_only //...

Optional Manual-Tagged Tests

Manual-tagged tests are excluded from default wildcard runs and can be triggered separately when deeper coverage is needed.

  • Workflow: .github/workflows/bazel-build.yml
  • Trigger: workflow_dispatch
  • Input: run_manual_targets=true

This job runs:

bazel query 'attr("tags", "manual", tests(//...))'
bazel test --build_tests_only <manual-test-targets>

Local Commands

Run default test behavior locally:

bazel test --build_tests_only //...

Run manual-tagged tests locally:

mapfile -t MANUAL_TEST_TARGETS < <(bazel query 'attr("tags", "manual", tests(//...))')
if (( ${#MANUAL_TEST_TARGETS[@]} > 0 )); then
bazel test --build_tests_only "${MANUAL_TEST_TARGETS[@]}"
fi

Frontend Testing (Vitest)

Website tests use Vitest with the following conventions:

  • Test files: src/*.test.tsx (colocated with source files)
  • Import from vitest: import { describe, it, expect } from "vitest"
  • Use createElement for component testing (not render)
  • Run via Bazel:
bazel test //apps/websites/customer:test
bazel test //apps/websites/support:test

Backend Testing (JUnit)

Microservice tests use JUnit 4 + Mockito:

  • Test files: src/test/java/com/myriad/<service>/...
  • JUnit 4 style with @Test, static imports from org.junit.Assert
  • Run via Bazel:
bazel test //apps/microservices/merchant-api:core_test
bazel test //apps/microservices/management-api:core_test
bazel test //apps/microservices/...

E2E Testing (Playwright)

Behavior-level integration tests verify end-user flows against the local dev environment.

cd apps/websites/customer && pnpm exec playwright test --list
cd apps/websites/support && pnpm exec playwright test --list