I manage to solve the problem differently.
First, I create custom IssueProccessor
that implements the corresponding interface in JUnit Pioneer library.
public class SimpleIssueProcessor implements IssueProcessor {
@Override
public void processTestResults(List<IssueTestSuite> issueTestSuites) {
/* this callback receives information about all tests marked with `@Issue` annotation */
}
}
Then I register it as Java ServiceLoader so JUnit uses the instance of the class during its lifecycle. In order to do that, I create a file src/test/resources/META-INF/services/org.junitpioneer.jupiter.IssueProcessor
with the content below:
com.my.company.SimpleIssueProcessor
This is the fully qualified name of the SimpleIssueProcessor
implementation.
And finally, I create another file src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener
with content:
org.junitpioneer.jupiter.issue.IssueExtensionExecutionListener
That's the JUnit TestExecutionListener
provided by JUnit Pioneer library that delegates information to IssueProcessor
implementation.
And that's basically it. Now you process the information in SimpleIssueProcessor
callback and build any documentation you want.