JUnit 4.11 get test result in @After

后端 未结 5 1237
梦毁少年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:17

    If there is no standard possibility (I'm pretty sure there was no possibility in JUnit 3.x), you can just

    write a Listener,

    push the Listener-events to a static Collection,

    and gather them from your @After- Method.

提交回复
热议问题