demo-junit-5 icon indicating copy to clipboard operation
demo-junit-5 copied to clipboard

publish report

Open Darkvater opened this issue 4 years ago • 1 comments

Hi, This repo is a great ource of information! I do have a question about the benchmark tests that record the test runtime. At some point in the code you do "context.publishReportEntry". Where does this end up? I've run the tests, everything but cannot see any of this information in any output file or console. How does that work? How do I get it into a test report for example? It would be great if you could shed some light on it.

P.S. reason I'm looking in this area is because I want to record all tests that will blow up (time bomb) within a certain time. I have all the information just cannot get it anywhere useful where something can pick up this information

Darkvater avatar Apr 23 '21 14:04 Darkvater

Hey Darkvater, I hope my reply isn't too late. Sorry it took so long.

From section 2.12:

The data can be consumed via the reportingEntryPublished() method in a TestExecutionListener, allowing it to be viewed in IDEs or included in reports.

In JUnit Jupiter you should use TestReporter where you used to print information to stdout or stderr in JUnit 4. Using @RunWith(JUnitPlatform.class) will output all reported entries to stdout. In addition, some IDEs print report entries to stdout or display them in the user interface for test results.

IntelliJ shows report entries in the run/debug panel for tests.

Also, check section 4.7.

And since you're interested in this feature, take a look at JUnit Pioneer's @Stopwatch extension (Pioneer is a JUnit extension pack I co-maintain.)

nipafx avatar May 08 '21 14:05 nipafx