Integration Tests with the Connect SDK
Author:
Fluent Commerce
Changed on:
8 June 2026
Key Points
- End-to-End Test Orchestration: You will learn how to wire, configure, and execute automated integration tests using specialized Connect SDK test modules (
`connect-sdk-test-core`,`connect-sdk-test-core-aws`, and`connect-sdk-test-core-kafka`) to validate custom data handlers against simulated API footprints and containerized queue systems. - Execution Command Restrictions: Standard unit test triggers like
`mvn test`will completely ignore these integration suites. You must invoke the pipeline using`mvn clean integration-test`and explicitly declare or preset the targeted active Spring profiles (such as`aws,localstack`or`kafka`) to instantiate the proper environment dependencies and messaging beans. - Isolated Bootstrapping Requirements: When building integration tests inside a decoupled code module that lacks a primary application runner, you must manually deploy an executable bootstrap class annotated with
`@SpringBootApplication`and`@EnableScheduling`inside your`src/test/java`directory. Additionally, you must place three mandatory configuration manifests (`application.yml`,`application-connector.yml`, and`bootstrap.yml`) into the`src/test/resources`folder. - Automated Environment Isolation: The test suite leverages
`Testcontainers`and`WireMock`to manage external asset lifecycles dynamically. Activating specific environment flags like`localstack`inside the configuration settings instructs the SDK to auto-provision localized mock instances of cloud services (including Amazon SQS queues, Amazon S3 buckets, and secrets vaults), eliminating the need to manage external persistent test infrastructure.
Prerequisites
Steps
Requirements to start
- application.yml
- application-connector.yml
- bootstrap.yml
If you want logging, you will have to add a `logback-spring.xml` file for the spring profile `it`.
Modules for Integration Tests
`connect-sdk-test-core`: Connect SDK base test utilities`connect-sdk-test-core-aws`: Extension of the SDK test utilities for projects using AWS`connect-sdk-test-core-kafka`: Extension of the SDK test utilities for projects using Kafka
Without Spring Profile
`MessageSender` the base class is using in the example below, it requires one to specify the spring profiles at the time of the execution of the tests. For modules that support multiple implementations, it may be required to run integration tests as many times as required to cover all the different ways it can be used. For example, the Connect SDK can work with both Kafka and SQS, and it requires running integration tests to run against both profiles.Spring profile will ensure the correct bean of `MessageSender` is available to the test class.
With Spring Profile
Base Integration Test Class - Example Implementation
Extending the Base Integration Test Class - Example Implementation
Testing Handler Logic - Example Implementation
Running Tests - Specifying Spring Profiles
`mvn test` does not run integration tests, only JUnits.
Running Tests - Configuring Properties for Services
`SecretsManager`, `S3` and `SQS` test containers, add the following to your application.yml in your test resources folder.