I'm interested in attaching a debugger to the unit tests in Elasticsearch. In the TESTING document, it mentions that I can attach a debugger to the running version of Elasticsearch launched via Gradle (e.g. gradle run --debug-jvm
), but there's no mention of a method for launching the unit tests in a debugger.
When reading the Gradle User Guide, the guidance is to pass a JVM switch to the test harness indicating that you want to attach a debugger (e.g. gradle test -Dtest.debug
). I've tried that, and several other incantations, given that the tests in Elasticsearch seem to use a nomenclature that's a bit different than the Gradle norm (e.g. gradle :core:test
).
Specifically, I'd like to attach the debugger to a single test, or test method:
gradle :core:test -Dtests.seed=B5E933798D9BAEDA \
-Dtests.class=org.elasticsearch.deps.joda.SimpleJodaTests \
-Dtests.logger.level=WARN \
-Dtests.security.manager=true \
-Dtests.locale=ar-LY \
-Dtests.timezone=Europe/Sarajevo
-D<WHAT GOES HERE???>.debug
I'm not very familiar with Gradle, so I need some guidance on how to launch a unit test, and then attach a debugger to that test? Maybe my challenge is that the unit tests are actually being launched via the Ant JUnit test runner?