JUnit 4.11 get test result in @After

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

    I am using something alike JamesB suggested. You might get to the point where you have to add timeouts to the tests, then =>>

    "setting the result of a test in a class member and then act on it in the @After method" would not always work if you have more than 1 assert. That's is my problem today, when i have testCaces that timeout, but my afterClass is assuming everything went smooth because the most recent assert has passed..

提交回复
热议问题