0

我有一些由@Before 方法设置并由@After 方法清理的单元测试。现在,如果测试成功与失败,我想对 @After-method 做一些不同的事情。我怎样才能做到这一点?

4

1 回答 1

-1

You need to use a boolean flag in your @After method to decide what you want to do in case of success or failure. You can simply define a flag isPassed in your test class, turn it true if test case passed or turn it false in case of failure. Simply read this variable in your @After method and decide about what you need to do.

于 2013-08-28T12:05:31.880 回答