Tests are the best form of specification because:
- Tests can be run, which means you can programmatically verify your implementation against your specification. If the tests pass, your implementation conforms to the specification.
- Tests are an integral part of the code (that is, Specification-as-Code (SaC)). There is less chance that your specification becomes outdated, because if it does, the test would fail.
Therefore, we can write our technical specifications as E2E tests, which then drives the TDD development process.