Detect Failure or Error of Junit Test in @After method

后端 未结 4 1646
你的背包
你的背包 2021-01-01 09:50

Is there a way in JUnit to detect within an @After annotated method if there was a test failure or error in the test case?

One ugly solution would b

4条回答
  •  滥情空心
    2021-01-01 10:16

    If you are lucky enough to be using JUnit 4.9 or later, TestWatcher will do exactly what you want.

    Share and Enjoy!

提交回复
热议问题