Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.39 KB

TESTING.md

File metadata and controls

35 lines (24 loc) · 1.39 KB

Testing with Testcontainers

This module uses Testcontainers to run Open Liberty in a Docker container during tests, providing an isolated and consistent testing environment.

Prerequisites

  • Docker installed and running
  • WAR file built (automatically handled by the build)

Running Tests

./gradlew :grooves-example-javaee:test

How It Works

  • Docker Image: Uses openliberty/open-liberty:full-java17-openj9-ubi
  • Configuration: Custom server.xml with JAX-RS 2.1, CDI 2.0, EJB Lite 3.2, and other required features
  • Application Deployment: WAR file is copied to /config/dropins/ for automatic deployment
  • Cross-platform: Includes Docker configuration for Mac ARM64 systems

Benefits

  • No Local Liberty Installation Required: Tests run in isolated Docker containers
  • Better CI/CD Integration: More portable across different environments
  • Consistent Testing Environment: Same Liberty version used everywhere
  • Parallel Test Friendly: Multiple test runs don't interfere with each other
  • Version Flexibility: Easy to test against different Liberty versions by changing the Docker image

Configuration Files

  • build.gradle: Testcontainers dependencies and Docker configuration
  • src/test/resources/server.xml: Liberty server configuration
  • src/test/groovy/grooves/example/javaee/PatientSpec.groovy: Main test class using Testcontainers