As software developers, we’ve all been there: a simple requirement change requires adding a tenantId field to your User model. It’s a five-minute code change, but suddenly, 458 tests are failing. It’s happening not because the logic is broken, but because the User model is used everywhere, and now the test data is invalid. I’ve […] The post Test Builders:…
#unit testing
6 posts
26 Mar
28 Dec 2020
Choosing test values when writing unit tests is mostly guided by the need to cover all cases of the program logic. However, some values are better than others. Here are a few tips on how to pick values that make … Continue reading →
1 May 2018
For the past few years, I have heard many people advocating using only automatic tests. For example, if all the automatic tests pass, then the code should automatically be deployed to production. I have always performed a bit of manual … Continue reading →
4 Sept 2014
A few months ago I came across the article Why Most Unit Testing is Waste by James O Coplien. The title is an accurate description of the contents – James considers most unit tests to be useless. He expands his arguments … Continue reading →
19 Feb 2014
When I first heard about unit testing using a framework like JUnit, I thought it was such a simple and powerful concept. Instead of ad hoc testing, you save your tests, and they can be run as often as you … Continue reading →
9 Feb 2014
How can you unit test private methods? If you google this question, you find several different suggestions: test them indirectly, extract them into their own class and make them public there, or use reflection to test them. All these solutions … Continue reading →