I remember some time ago I was really excited about the idea of soft assertions. The latest blog post by Rafał Borowiec reminded me about them. …but wait, if I was so crazy about them some time ago, then how it happened that now I need to be reminded about their existence?

So first of all, I believe they make sense only for integration or e2e tests. Only, where execution of test is so costly (in terms of time) that you really, really want to learn as much about the tested scenario as possible. So, if you have a long (Webdriver) test, which ends with bunch of asserts, then I think it might make sense to write them using soft assertions.

But for unit tests? Oh no, you do not need soft asserts! Execution of such test takes milliseconds so rerunning them is simply a matter of few keystrokes using your IDE. Not much gained by soft asserts here.
And I also see a potential downside. I think that using soft asserts might lead you into the wrong direction: it might encourage you to verify much more then required, or to verify different thing “because you can”. No, thank you, I strongly believe you should go with one (logical!) assertion per test.

So, all in all, my initial excitement about the soft assertions has vanished over the years. I would never use them for unit tests, and I do not use them for other kind of tests. Why not? I think that when I first learned about them they were not supported by the tools so I gave up the idea. And later… well, I think I got used to not using them, and as I think now about my E2E/GUI/Integration tests I do not see compelling reasons to change my mind.

Just my 3 cents.

Few days ago I learned a very simple, yet powerful trick which saved me some time. To make long story short, it happened on a test environment shared between few projects.

I deployed a new version of one application there, and after some time received emails with errors. Uh-oh, apparently I have broken something! Hmm… but what really happened? The stacktrace hasn’t really enlightened me in any way… Hmm…. But you know what? The entity that was printed out in the exception message looked like this:
User{email='john.kowalski.somerandomstuff@whatever.com}

And it happened that John Kowalski was my colleague working on a different team (but using the same test environment). To solve the mystery of “why-oh-why-it-does-not-work-all-tests-are-green-for-gods-sake” all I had to do was to have a short chat with him. It appeared that he was running some IT-tests which were using some incomplete data (at least from my point of view), well, it doesn’t really matter. The thing is, that thanks to him signing his work, I was able to solve my problem pretty fast.

So don’t be shy about your IT/E2E test. Sign them, and maybe someone will be thankful for this.

And BTW if you would like to learn more about writing high-quality tests then check my Bad Tests, Good Tests book.