Chapter 4. Tasty testing

 

Chapter 4 from Street Coder by Sedat Kapanoglu

This chapter covers

  • Why we hate testing and how we can love it
  • How to make testing more enjoyable
  • Avoiding TDD, BDD and other three-letter acronyms
  • Deciding on what to test
  • Doing less work using tests
  • Making tests spark joy

Many software developers would liken testing to writing a book: it’s tedious, nobody likes doing it, and it rarely pays off. Testing is considered like a second-class activity compared to coding, not doing the real work. Testers are subjected to preconceptions like they are having it too easy.

The reason behind the dislike for testing is that we developers see it as a process disconnected from building software. Building software is all about writing code from a programmer's perspective, whereas it’s all about setting the right course for the team from a manager's vantage point. Similarly,  for a tester, it’s all about the quality of the product. We consider testing an external activity because of our perception that it's not part of the software development and we want to get involved as little as possible.

Testing can be an integral part of a developer’s work and help them along the way. It can give you assurances that no other understanding of your code can give you. It can save you time, and you don’t even need to hate yourself for it. Let’s see how.

4.1   Types of tests

4.1.1   Manual testing

4.1.2   Automated tests

4.1.3   Living dangerously: testing in production

4.1.4   Choosing the right testing methodology

4.2   How to stop worrying and learn to love the tests

4.3   Don't use TDD or other acronyms

4.4   Write tests for your own good

4.5   Deciding on what to test

4.5.1   Respect boundaries

4.5.2   Code coverage

4.6   Don't write tests

4.6.1   Don't write code

4.6.2   Don't write all the tests

4.7   Let the compiler test your code

4.7.1   Eliminate null checks

4.7.2   Eliminate range checks

4.7.3   Eliminate valid value checks

4.8   Naming tests

4.9   Summary