Chapter 8. TESTING TIMES

The Black Art of Testing Code

Test everything. Keep what is good.

1 Thessalonians 5:21

Write as much code as you like—there’s one thing you can be sure of: It won’t work perfectly the first time. It doesn’t matter how long you took to carefully design it; software faults have a creepy ability to work their way into any program. The more code you write, the more faults you’ll introduce. The faster you write, the more you’ll introduce. I’ve yet to meet a really prolific programmer who created anything near bug-free code.

What do we do about this? We test our code. We do this to find any problems that exist, and once we’ve fixed them, we use the tests to maintain confidence in the quality of the code as we continue to modify ...

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.