Re:Stop requiring only one assertion per unit test: Multiple...
by edgyquant on Saturday November 05, 2022 @05:25PM
(#33485972)
This is a feature. I want it to fail fast so I can see the first issue not crawl the stack for error logs.
Re:Stop requiring only one assertion per unit test: Multiple...
by un_montagnard on Saturday November 05, 2022 @06:14PM
(#33486467)
I personally prefer seeing everything that I broke, not just the first one
That doesn't mean you have to duplicate code, you can deal with it in other ways. In Junit I like to use @TestFctory [1] where I'll write most of the test in the Factory and then each assertion will be a Test the factory creates, and since they're lambdas they have access to the TestFactoy closure.
[1] https://junit.org/junit5/docs/current/user-guide/#writing-te...