The Gradle plugin used to run the system tests supports the debugging of the services running inside Docker containers. This makes debugging issues with system tests so much less painful.
Note: Service debugging is currently only supported through the IntelliJ IDE. If you’re using another IDE, then please consider contributing to get service debugging working for your IDE.
Debugging of services currently requires the AttachMe IntelliJ plugin to be installed.
aggregate-template repository has preconfigured the service to support debugging.
Debugging a service
With AttachMe plugin installed, the
handle-occurrence-service can be debugged with the following steps:
- Create and run an
- Name the new configuration, but leave the default port at the default
- Place the required breakpoints in the code. For example, place one in the
Run the system tests, specifying which service to debug:
./gradlew systemTest \ --debug-service="handle-occurrence-service" \ --verification-timeout-seconds=9999
When the system tests start the
handle-occurrence-service Docker container, the service will attach to the debugger.
This will cause a new debug window to open and for the breakpoint to be hit:
Pretty cool, right?
--verification-timeout-seconds argument increases the amount of time the system tests wait
for the expected output, allowing more time to debug the code. Learn more on this, and other options,
in the system test plugin documentation.