| name | testing-standards |
| description | Testing conventions, test runner configurations, coverage requirements, and failure interpretation for the Klassenzeit monorepo. |
Testing Standards
Test Runner Commands
Backend (Spring Boot / JUnit)
make test-backend
./gradlew test
./gradlew test --tests "ClassName"
Frontend (Vitest / React Testing Library)
make test-frontend
npm run test
npm run test:watch
npm run test:coverage
npm run test:ui
E2E (Playwright)
make test-e2e
npm run test:e2e
npm run test:e2e:ui
npm run test:api
Coverage Reports
| Type | Location | Minimum Threshold |
|---|
| Backend | backend/build/reports/jacoco/test/html/index.html | 80% line coverage |
| Frontend | frontend/coverage/index.html | 80% line coverage |
| E2E | e2e/playwright-report/index.html | Critical paths covered |
Coverage Requirements
- New code: Minimum 80% line coverage
- Public API functions: Must have unit tests
- Critical user flows: Must have E2E tests
- Edge cases: Error scenarios must be tested
Interpreting Failures
Priority Order
- Check if failure is flaky (re-run once with same seed)
- Look for recent changes to test file or tested module
- Check for environment issues (missing fixtures, DB state, port conflicts)
- Inspect assertion messages carefully for root cause
Common Failure Patterns
Backend
NullPointerException: Missing mock setup or fixture data
ConstraintViolationException: Invalid test data for entity constraints
LazyInitializationException: Missing @Transactional or eager fetch
Frontend
Unable to find element: Component not rendered, wrong query, async timing
act() warning: State update outside test act boundary
Mock not called: Wrong mock path or missing mock setup
E2E
Timeout: Slow page load, element not visible, wrong selector
Element not attached: DOM changed between find and action
Navigation error: Auth redirect, missing route, CORS issue
Test File Conventions
- Backend:
src/test/java/**/*Test.java
- Frontend:
src/**/*.test.tsx (co-located with source)
- E2E:
e2e/tests/**/*.spec.ts
Pre-Test Checklist
- Services running (
make services-up)
- Database migrated (Flyway runs on backend startup)
- Environment variables set (
.env files in place)
- Dependencies installed (
npm install in frontend/e2e)