JUnit 4.11 get test result in @After

后端 未结 5 1258
梦毁少年i
梦毁少年i 2020-12-19 07:09

Is there any way I can get the test result in the teardown (@After) method? I\'d like to do clean up after the tests depending on the result.

Could not

5条回答
  •  感情败类
    2020-12-19 07:23

    The closest thing to what you're asking for would probably be the TestWatcher rule. That won't give you access to a returned result or anything, but you can use it (or create your own TestRule and combined with the Description object, you could annotate your methods differently to indicate what sort of clean-up is necessary.

提交回复
热议问题