Is there a class/method I could implement within JUnit that is basically a "hook" that runs after each test case finishes, with user-defined (in code) metadata available?
I'm trying to accomplish something like this:
- Annotate a test case with a user-defined annotation, such as team ownership (e.g.
@Team(Teams.PAYMENTS)
) - Print test result to console with 3 values: test name (test function name), status (pass/fail), and team (annotation value)
For simplicity, I just need to print this info (later it will get published elsewhere), but I'm really lost in where I could obtain this test metadata information in one place, after the test runs?
I tried to override the finish method in one of our TestRunner
class:
override fun finish(resultCode: Int, results: Bundle?) {
System.out.println("===breakpoint here===")
super.finish(resultCode, results)
}
but when debugging, there was no test metadata here. Any suggestions on how I could approach this?
Thank you!