Can I make JUnit more verbose?

后端 未结 10 2106
再見小時候
再見小時候 2021-01-03 21:52

I\'d like to have it yell hooray whenever an assert statement succeeds, or at the very least have it display the number of successful assert statements that were encountered

10条回答
  •  一个人的身影
    2021-01-03 22:22

    Hard to be done. All assert methods are static members of the class Assert, which implies that the RunNotifier (which counts the successful and failed tests) is not within reach.

    If you dont refrain from an ungly hack: take the sources from JUnit, patch them to store the current notifier in a static field of Assert when running tests such that the static methods can report successful asserts to this notifier.

提交回复
热议问题