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 #programming #tdd
@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 https://medium.com/@pjbgf/title-testing-code-ocd-and-the-aaa-pattern-df453975ab80 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.
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
Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.