Can I make JUnit more verbose?

后端 未结 10 2038
再見小時候
再見小時候 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:10

    I'm pretty sure you can create a custom TestRunner that does that. We ended up with something similar in our homemade Unit-testing framework (a clone of NUnit).

    Oh, wait - now that I'm reading your question again, if you really want output for each successful assertion, you'll have to dig into the plumbing more. The TestRunner only gets called once for each testcase start/end, so it'll count passed and failed tests, not assertions.

    This isn't much of a problem for me, since I tend towards one assertion per test, generally.

提交回复
热议问题