Discussion about this post

User's avatar
Paul-Sebastian Manole's avatar

My opinion is that people write tests like this because of the setup phase. If the testing is not done right, if the abstractions are in the wrong place, or they are wrong, or your module seams are not where they should be, it can be really costly to set up the world for a test, so that is why people bunch up multiple assertions in the same test. You see this a lot in E2E tests as well. I think altogether these experiences from writing incorrect test suites lead to this learned behaviour.

Patrick's avatar

One addition I would make for such tests, if the test framework allow it, is to change all earlier asserts to assumes. That way if an earlier step fails, all tests that depend on that step will show as inconclusive, making finding the actual failure easier.

2 more comments...

No posts

Ready for more?