sbrannen/junit5-demo

Unable to get the TestResults using @testDisabled, @testFailed, @testSuccessful and @testAborted

gaurikuwar opened this issue · 1 comments

Hi,
Thanks for the sample and youtube presentation :)
I am using springboot with gradle along with Junit5. I am trying to use TestWatcher to perform certain actions on failure of a test case. However, the @testDisabled, @testfailed, @testSuccessful and @testAborted do not get invoked. I tried adding a print statement to the testDisabled and @testfailed functions and they did not get printed. I have tried the same on your project junit5-demo (in SkipOnFailuresInEnclosingClassExtension.class) but it does not reach the @testDisabled/@testfailure functions. Can you please suggest on it? My intension is to perform certain actions based on the test result. I also tried using @ExtendWith(SkipOnFailuresInEnclosingClassExtension.class) in the test but could not get it working. Could please suggest on it?

Thanks for the sample and youtube presentation :)

You're welcome!

I am trying to use TestWatcher to perform certain actions on failure of a test case. However, the @testDisabled, @testfailed, @testSuccessful and @testAborted do not get invoked.

Feel free to check out the tests used in the JUnit 5 test suite: https://github.com/junit-team/junit5/blob/master/junit-jupiter-engine/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java

Otherwise, please post a question on Stack Overflow.

Thanks