background preloader

CleanCode

Facebook Twitter

Intro to Unit Testing 9: Tips and Tricks. This, I’ve decided, is going to be the penultimate post in this series. I had originally targeted a 9 part series, finishing up with a “tips and tricks” post, the way you often see with technical books. But I think I’m going to add a 10th post to the series where I make the business case for unit testing. That seems like a more compelling wrap up to the series. So, stay tuned for one more after this. This post is going to be a collection of tips and tricks for new and veteran unit testers.

Structure the test names for readability beyond just descriptive names. The first step in making your unit tests true representation of business statements is to give them nice, descriptive names. When you’re writing unit tests, it’s easy to gloss over names of the tests the way you might with methods in your production code. But it goes beyond simply giving tests descriptive names. Create an instance field or property called “Target” Keep Your Mind on AAA AAA. Keep your instantiation logic in one place. Fazit | heise Developer. Fazit Obwohl die Metapher der "technischen Schulden" breit genutzt wird, ist sie nicht konstruktiv: Sie weist zwar auf Probleme hin, aber gibt keine Hinweise, wie sich diese lösen lassen. Sie misst lediglich die Qualität des Codes. Und diese Information ist völlig irrelevant, bis der Code zu ändern ist. Dann ist die Qualität aber entscheidend.

Um mit diesem Problem umzugehen, bietet sich die Metapher der Qualitätsinvestition an: Jede Verbesserung verursacht einen Aufwand. Eberhard Wolff arbeitet als freiberuflicher Architekt und Berater. Felix Müller arbeitet als IT Consultant und Softwareentwickler bei der codecentric AG. Literatur Thomas Haug; Alles im Blick; Einsatz von SonarQube zur Qualitätssicherung in heterogenen Projekten; Artikel auf heise Developer.