Can I make JUnit more verbose?

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

    This is not a straight answer to the question and is in fact a misuse of a junit feature, but if you need to debug some values that are used in the asserts, then you can add temporarily something like:

    Assume.assumeTrue(interestingData, false);
    

    This won't fail the build, but will mark the test as IGNORED, and will force the values to be included in the test report output.

    ❗️ Make sure to remove the statements once you are done. Or, as an alternative, you can change the statement to Assume.assumeTrue(interestingData, true) in case you might want to debug it again in the future.

提交回复
热议问题