An important part of software engineering is program testing (or software testing). We need to ensure our program works correctly and efficiently (in terms of runtime and space). The practice of developing tests as or before you code is test-driven development. In this approach, the tests are the detailed specification that can be executed against and not just read.

There are a few main types of tests:

  • End-to-end tests are user-like input to end-user output, basically testing what an end-user would type in.
  • Unit tests are used to test small pieces of a system, i.e., single classes or functions.

It’s a good idea to do automated building and testing. This makes it easy to do the right thing:

  • An easy command to build (with a Makefile).
  • An easy way to test.
  • An easy way to deploy:
    • Send to the real website and real users.
    • Split into an AB test.
    • And it’s easy to reverse deployment if it’s a bad idea.
    • Continuous deployment requires good automated tests.

Philosophy

Assume: “if you didn’t test it, it doesn’t work”. Assume all code is broken until proven otherwise: look at what the program does not what it’s supposed to do; think of every case your program should handle.

What happens when our systems fail? What if people rely on our systems? How can we make these as safe as possible? Our software must be robust in these cases.