To step through a Java test that you’re running with bazel test
, use the --java_test
flag:
$ bazel test --java_debug //src/test/java/com/example:hello-test WARNING: Streamed test output requested so all tests will be run locally, without sharding, one at a time. INFO: Found 1 test target... Listening for transport dt_socket at address: 5005
At this point, switch over to your IDE and fire up a remote debugging configuration, with the host localhost:5005. The debugger will attach to the running process, your test will start, and the debugger will stop at your first breakpoint.