testing-standards
Testing conventions, test runner configurations, coverage requirements, and failure interpretation for the Klassenzeit monorepo.
When & Why to Use This Skill
This Claude skill provides a comprehensive framework for testing standards within the Klassenzeit monorepo, covering test runner configurations, coverage requirements, and systematic failure interpretation. It streamlines the quality assurance process by offering standardized commands for backend, frontend, and end-to-end testing, ensuring code reliability and consistent performance across the entire development lifecycle.
Use Cases
- Standardizing test execution: Use predefined commands for Spring Boot, Vitest, and Playwright to ensure consistent testing across the monorepo.
- Enforcing code quality: Monitor and maintain a minimum of 80% line coverage for new code and public API functions to meet project requirements.
- Efficient debugging: Utilize the failure interpretation guide to quickly identify and resolve common patterns like flaky tests, environment issues, or assertion errors.
- Onboarding and compliance: Provide developers with a clear pre-test checklist and file naming conventions to maintain repository structure and stability.
| 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 # Run all backend tests
./gradlew test # Direct Gradle command
./gradlew test --tests "ClassName" # Run specific test class
Frontend (Vitest / React Testing Library)
make test-frontend # Run all frontend tests
npm run test # Run tests once
npm run test:watch # Watch mode
npm run test:coverage # With coverage report
npm run test:ui # Vitest UI
E2E (Playwright)
make test-e2e # Run all E2E tests
npm run test:e2e # Direct Playwright run
npm run test:e2e:ui # Playwright UI mode
npm run test:api # API integration tests only
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 dataConstraintViolationException: Invalid test data for entity constraintsLazyInitializationException: Missing@Transactionalor eager fetch
Frontend
Unable to find element: Component not rendered, wrong query, async timingact() warning: State update outside test act boundaryMock not called: Wrong mock path or missing mock setup
E2E
Timeout: Slow page load, element not visible, wrong selectorElement not attached: DOM changed between find and actionNavigation 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 (
.envfiles in place) - Dependencies installed (
npm installin frontend/e2e)