Live data from Hacker News

Tests Are About Design

openmymind.net

1–2 of 2 posts

Re: Tests Are About Design

#2
I find it much more helpful to think in terms of why and what we will test rather than how much will we test. This approach resolves a few of the frequently debated issues around testing, such as:

1. Should I test first, or test later?

2. What is the right amount of code coverage?

3. Should I write more unit tests or integration tests?

4. Should I use mocks or not?

and so on...

The above questions can have an arbitrary answer that makes sense in a certain context but may not yield the best cost / benefit ratio in other contexts. Hence, the guiding star needs to be: why are we writing a test.