Real-Time Test Reports for JUnit?

I’m helping to migrate an existing build system to Gradle. The existing build system monitors the test output directories for
output to determine the results for that test in real-time. The goal is to keep the real-time status check for tests after migrating.

From my understanding, Gradle gathers all the test results in an internal ‘output.bin’, and then at the end of the ‘tests’ task creates the XML/HTML reports for JUnit.

Is there an option to generate one of these two outputs after a test finishes, but while the tests task is still running? If not, am I correct in assuming my best bet is to use the TestListener APIs to create my own output that I can use?

There is no functionality for generate the xml output directly after a test has finished. You’re right, the TestListener API is the way to go here.