Creek captures code coverage metrics from your service, running inside the Docker container, when running the system tests. It does this by leveraging the JaCoCo Gradle plugin and some smarts to configure the service running in the Docker container.

Test coverage is calculated by running the following Gradle command:

./gradlew coverage

The human-readable coverage report is saved to build/reports/jacoco/coverage/html/index.html.

System test coverage

With just the system tests, the test coverage is pretty good for our new service. The only think really missing is coverage of the io.github.creek.service.basic.kafka.streams.demo.api package, and that is because we’ve not yet looked at utilising the aggregate descriptor defined in that package.

Note: The aggregate descriptor defines the API on an aggregate, one abstraction level up from services, and will be covered in the final quick-start tutorial: Kafka Streams: aggregate API tutorial

In the next step, we will add unit tests. However, with good system test coverage we recommend that unit testing is limited to testing edge cases that are hard, or impossible, to test using the system tests. Use system testing to test both the happy and error paths of your business logic.

Updated: