Testing

The test suite is split by risk and feedback speed.

Unit Tests

Fast unit tests cover domain and use-case behavior:

Unit tests use small hand-written fakes for application-service collaborators. That keeps the behavior explicit and avoids bytecode-agent warnings for simple interaction tests.

Run:

mvn test

Architecture Tests

ArchUnit tests live in ecommerce-app and import the production packages. They enforce module boundaries and keep the shared kernel independent.

Rules include:

Integration and API Tests

EcommerceApplicationIT uses Testcontainers for PostgreSQL and Redis. It verifies:

Run the full suite:

mvn clean verify

Docker must be available for Testcontainers. The test class is marked with disabledWithoutDocker = true so local environments without Docker can still run the rest of the suite. A local mvn clean verify run without Docker is useful, but it is not a full integration-test signal.

mvn clean verify also generates the aggregate JaCoCo report through the build-only coverage-report module:

coverage-report/target/site/jacoco-aggregate/index.html

Generate human-readable Surefire and Failsafe HTML reports after tests have run:

mvn surefire-report:report-only surefire-report:failsafe-report-only

CI publishes those generated reports to:

On Windows, run the full suite with Docker Desktop started, the WSL 2 based engine enabled, and Docker set to Linux containers. docker version should show a server section before Maven is expected to run Testcontainers.

CI

The main CI workflow runs mvn clean verify on pushes to master and pull requests. GitHub-hosted Linux runners provide Docker, so Testcontainers integration tests run there.

The unified CI workflow also builds documentation on master. It generates aggregate JavaDoc, starts PostgreSQL and Redis with Docker Compose, runs the generate-openapi Maven profile, and publishes Markdown docs, JavaDoc, a static Swagger UI page, and OpenAPI JSON to GitHub Pages.