Two years ago I have started to write unit tests because I was so sick of my colleagues messing up my work when they did changes to it. I have started to do test driven development this year. And I absolutely ❤️ it. It influences the creative process of writing complex programs in the most simple way very positively

@WabuMike Unit tests are awesome.
I really need to get into a mindset of making thorough ones though.

Do you have advice/links for getting better at unit tests?

@GreetingsFrom617Patroclus One pattern that has helped me writing tests when I didn't know where to start is the arrange-act-assert pattern The key is to focus on a single assertion for each test.

@WabuMike Welcome to the club. Once you go tdd you never go back :) The key is making sure everyone knows its a rule that any patch tehy submit must include a unit test that has full coverage of the code they are commiting.

Having the whole team commited to TDD benefits even more: it allows to create processes upon the regression test suite (continuous integration)

TDD is a way to increase trust in teams thanks to a concret red/green indicator.

One thing I appreciate is how often I am surprised realizing I just completed the feature with my last test. I guess without TDD I would just go for a useless extra work.

True that! Writing unit tests felt like "extra work" before I adopted tdd

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.