Skip to main content

How to run tests

Run the test suites for each platform in the monorepo. Tests are organized by platform with consistent conventions.

Quick reference​

PlatformRun allRun specificWatch modeCoverage
Backend./gradlew test./gradlew test --tests "*.SomeTest"N/A./gradlew test jacocoTestReport
Frontendpnpm testpnpm test -- SomeComponentpnpm test:watchpnpm test -- --coverage
MLuv run pytestuv run pytest tests/unit/test_some.pyuv run pytest-watchuv run pytest --cov

Platform details​

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

CI behavior​

CI runs tests automatically based on which files changed:

TriggerTests runWorkflow
backend/** or proto/** changedBackend unit + integration.github/workflows/ci.yml
frontend/** changedFrontend unit.github/workflows/ci.yml
ml/** changedML unit.github/workflows/ci.yml
Manual dispatchAll 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​