Overview
The cdr-public-test-utils library provides powerful tools for writing tests that interact with Smile CDR. Two of the most important components in this library are SmileCdrContainer and SmileHarness, which together enable developers to easily set up and interact with Smile CDR instances in their tests.
SmileCdrContainer is a specialized Testcontainers implementation that simplifies the process of running Smile CDR in Docker containers for testing purposes. It extends the GenericContainer class from the Testcontainers library and provides Smile CDR-specific functionality.
Key features of SmileCdrContainer include:
SmileHarness instance for interacting with the running Smile CDR container.SmileHarness is an interface that provides a unified common API for interacting with a Smile CDR instance during testing. It abstracts away the details of connecting to different endpoints and services within Smile CDR, making it easier to write tests that interact with these services.
The primary implementation, DockerSmileHarness, is designed to work with Smile CDR instances running in Docker containers, particularly those managed by SmileCdrContainer.
Key features of SmileHarness include:
FhirContext for the Smile CDR instance.In a typical test scenario:
SmileCdrContainer is created and started, which launches a Smile CDR Docker container.SmileCdrContainer provides a SmileHarness instance through its getHarness() method.SmileHarness to obtain clients for interacting with the Smile CDR instance.This approach allows for comprehensive integration testing of applications that interact with Smile CDR, without the need to manually set up and configure a Smile CDR instance for each test run.
For more information on how to use these components in your tests, see the other documentation in this section. For a tutorial, please check out the tutorial page.
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.