Dev.to
7/18/2026

The original title is: "Testing Keycloak SPIs with Testcontainers — the part every tutorial skips"
Original: Testing Keycloak SPIs with Testcontainers — the part every tutorial skips
Short summary
A practical guide to integration-testing Keycloak SPIs using Testcontainers, covering the gap most tutorials skip. It shows how to boot a real Keycloak container, copy your built jar into providers/, and verify deployment via the admin REST API. Also covers testing event listener providers against a real Kafka broker and the Maven wiring needed to run these tests in the right lifecycle phase.
- •Boot real Keycloak in Testcontainers and verify SPI deployment via admin REST API
- •Use Wait.forHttp instead of log messages to avoid flaky CI tests
- •Integration-test event listeners against real Kafka to catch config errors mocks miss
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



