Testing
Backend
The backend has two types of tests, each run by a different Maven plugin.
Unit Tests
Unit tests use JUnit 5 with Mockito and don’t require a running database or application context. They follow the *Test.java naming pattern and are run by the Maven Surefire plugin.
cd backend/spring-boot
./mvnw -B testTo run a single test class:
./mvnw -B test -Dtest=MessageServiceTestTo run a single test method:
./mvnw -B test -Dtest=MessageServiceTest#getMessageIntegration Tests
Integration tests use Spring Boot Test with Testcontainers to spin up real PostgreSQL and Redis instances in Docker. They follow the *IT.java naming pattern and are run by the Maven Failsafe plugin.
cd backend/spring-boot
./mvnw -B failsafe:integration-test failsafe:verifyTo run a single integration test:
./mvnw -B failsafe:integration-test -Dit.test=AuthControllerIT failsafe:verifyAll integration tests extend the TestcontainersConfig base class, which spins up shared PostgreSQL, Redis, and Mailpit containers. PostgreSQL uses @ServiceConnection for automatic Spring Boot configuration; Redis and Mailpit use @DynamicPropertySource to inject their host/port at runtime.
Tests that trigger emails can use the mailpit() helper to assert emails were received:
mailpit().clearMessages();
// ... perform action that sends an email ...
assertEquals(1, mailpit().getMessageCount());Docker must be running for integration tests to work.
Frontend
Unit Tests
Unit tests use Vitest . Test files follow the *.{test,spec}.{js,ts} pattern inside src/.
cd frontend/svelte-kit
pnpm run test:unitEnd-to-End Tests
E2E tests use Playwright with Firefox. Test files are in the tests/ directory. Playwright builds the app and starts a preview server on port 4173 before running.
cd frontend/svelte-kit
pnpm run test:integrationTo run both unit and E2E tests:
pnpm run test