How to run tests
Run the test suites for each platform in the monorepo. Tests are organized by platform with consistent conventions.
Quick reference
| Platform | Run all | Run specific | Watch mode | Coverage |
|---|---|---|---|---|
| Backend | ./gradlew test | ./gradlew test --tests "*.SomeTest" | N/A | ./gradlew test jacocoTestReport |
| Frontend | pnpm test | pnpm test -- SomeComponent | pnpm test:watch | pnpm test -- --coverage |
| ML | uv run pytest | uv run pytest tests/unit/test_some.py | uv run pytest-watch | uv run pytest --cov |
Platform details
- Backend (Kotlin)
- Frontend (TypeScript)
- ML (Python)
Unit tests
cd backend/platform
./gradlew test
Unit tests live in src/test/kotlin/ and follow the pattern *Test.kt. They test individual classes and functions without external dependencies.
Integration tests
./gradlew integrationTest
Integration tests live in src/integrationTest/kotlin/ and test database queries, API endpoints, and inter-layer communication. They require a running PostgreSQL instance (Testcontainers handles this automatically).
Running specific tests
# By class name
./gradlew test --tests "*.GenerationServiceTest"
# By package
./gradlew test --tests "com.aucert.domain.generation.*"
# By method name
./gradlew test --tests "*.GenerationServiceTest.should generate scenarios for login flow"
Coverage
./gradlew test jacocoTestReport
Report is generated at build/reports/jacoco/test/html/index.html.
Test structure
backend/platform/src/
├── test/kotlin/com/aucert/
│ ├── domain/generation/ # L1 unit tests
│ ├── domain/execution/ # L2 unit tests
│ ├── domain/analysis/ # L3 unit tests
│ ├── domain/pipeline/ # L4/L5 unit tests
│ └── api/ # Controller unit tests
└── integrationTest/kotlin/com/aucert/
├── persistence/ # Repository integration tests
└── api/ # Full API integration tests
Unit tests
cd frontend/apps/console
pnpm test
Tests use Vitest + React Testing Library. Test files live alongside components as *.test.tsx or *.test.ts.
Watch mode
pnpm test:watch
Reruns affected tests on file save — fast feedback during development.
Running specific tests
# By filename pattern
pnpm test -- SomeComponent
# By test name
pnpm test -- -t "should render loading state"
Coverage
pnpm test -- --coverage
Report is generated at coverage/index.html. CI enforces minimum coverage thresholds.
Test structure
frontend/apps/console/src/
├── components/
│ ├── TestRunCard.tsx
│ └── TestRunCard.test.tsx # Co-located test
├── hooks/
│ ├── useTestRuns.ts
│ └── useTestRuns.test.ts
└── lib/
├── api.ts
└── api.test.ts
Unit tests
cd ml
uv run pytest
Tests use pytest. Test files live in tests/ following the test_*.py convention.
Running specific tests
# By file
uv run pytest tests/unit/test_embeddings.py
# By test name pattern
uv run pytest -k "test_embedding_dimension"
# Verbose with short tracebacks
uv run pytest -v --tb=short
Coverage
uv run pytest --cov=src --cov-report=html
Report is generated at htmlcov/index.html.
Test structure
ml/
├── src/ # Source code
└── tests/
├── unit/ # Pure logic tests (no external deps)
├── integration/ # Tests with model API calls (require credentials)
└── conftest.py # Shared fixtures
CI behavior
CI runs tests automatically based on which files changed:
| Trigger | Tests run | Workflow |
|---|---|---|
backend/** or proto/** changed | Backend unit + integration | .github/workflows/ci.yml |
frontend/** changed | Frontend unit | .github/workflows/ci.yml |
ml/** changed | ML unit | .github/workflows/ci.yml |
| Manual dispatch | All platforms | .github/workflows/ci.yml (workflow_dispatch) |
Debugging failed tests
Backend: test fails with "connection refused" to database
Integration tests use Testcontainers, which requires Docker running. Verify:
docker info # Should show Docker engine info
If Docker isn't running, start it. Testcontainers automatically spins up a PostgreSQL container.
Frontend: test fails with "act(...) warning"
This usually means an async state update isn't wrapped properly. Use waitFor:
import { waitFor } from '@testing-library/react';
await waitFor(() => {
expect(screen.getByText('Expected text')).toBeInTheDocument();
});
ML: test fails with "model not found" or API error
Unit tests should mock API calls. If a test calls a real API, it belongs in tests/integration/ and requires credentials. Check that the test file is in the correct directory.
What's next
- How to add an API endpoint — End-to-end guide
- How to deploy to dev — Push to AKS
- How to run the backend — Backend dev server