sdk-testing
that integrates with JUnit 5 and Testcontainers to start up a Restate container together with your services code and automatically register them.
Add the following dependency to your project: .
Using the JUnit 5 Extension
Given the service to testMyService
, annotate the test class with @RestateTest
and annotate the services to bind with @BindService
:
RestateTest
Javadocs.
Once the extension is set, you can implement your test methods as usual, and inject a Client
using @RestateClient
to interact with Restate and the registered services:
Usage without JUnit 5
You can use the testing tools without JUnit 5 by usingRestateRunner
directly.
For more details, refer to the Javadocs.