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.

We all know that rubber duck is programmer’s best friend (it was also proven that such duck should be yellow for maximum effect). Not surprisingly I have also a yellow toy on my desk. But it is not a duck. It is a little yellow human-like figure.

Usually it sits and waits for me to start explaining some code. It waits patiently till I get to the aha! moment. Sometimes it waits long. But it never gets bored. From time to time I can see it’s smile widens when I explain the nuances of my-oh-so-perfect-and-surely-working code.

2015_09_yellow_static

But that is something which every rubber duck can do for you. My yellow friend has one hidden superpower which makes it much more useful. Look at the next image. Awesome, isn’t it?!

2015_09_yellow_hold

See? When I take my laptop home my yellow friend makes sure next time I come to the office I won’t have to dive under my desk to catch the cables. Cool, isn’t it?