Fluent Commerce Logo
Docs

Integration Tests with the Connect SDK

How-to Guide

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.

Steps

Step arrow right iconRequirements to start

It is also required to create the necessary configuration files on your src/test/resources folder.
  • application.yml
  • application-connector.yml
  • bootstrap.yml
No alt providedIf you want logging, you will have to add a `logback-spring.xml` file for the spring profile `it`.

Step arrow right iconModules for Integration Tests

Connect SDK includes test modules to assist with 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

Step arrow right iconWithout Spring Profile

In this approach, all tests implemented using this base class are not bound to run with AWS for example. To control what `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.

Step arrow right iconWith Spring Profile

Whenever the profile is specified, the spring profile is preset and there is no need to specify them at the time of the execution of the tests.

Step arrow right iconBase Integration Test Class - Example Implementation

Here is a full example of a base integration test class:Once you have done the above, you should be able to start writing tests. Any integration test class should extend the base test class created above.

Step arrow right iconExtending the Base Integration Test Class - Example Implementation

public class EventQueueIntegrationTest extends AwsBaseIntegrationTest

Step arrow right iconTesting Handler Logic - Example Implementation

If you want to test any handler logic you may need to setup stubs and assert that wiremock is called. Some basic utility functions to assist with that are provided. Below is an example of how you might do this.

Step arrow right iconRunning Tests - Specifying Spring Profiles

Depending on how the integration tests were written (with or without spring profiles fixed), you may or may not need to specify the spring profiles when executing the integration tests.Note that `mvn test` does not run integration tests, only JUnits.

Step arrow right iconRunning Tests - Configuring Properties for Services

You will also need to configure some properties depending which services you are using. To enable `SecretsManager``S3` and `SQS` test containers, add the following to your application.yml in your test resources folder.

Step arrow right iconRunning Tests - Kafkta Instead of AWS SQS

If you want to use Kafka instead of AWS SQS, then just add the following to your configuration: