Session

How to TDD a REST API

Level: All

If you’re working with a framework for writing APIs (and who doesn’t), writing tests up front, almost guarantees the tests will be ugly. And the code might not be that great, either. TDD is great for unit tests, but if you take it up a level, for REST APIs, or an end-to-end behavior, TDD may not look like the tool as advertised.

Unless…

TDD can work for building REST APIs. And I’m not talking about just writing a test before the code, but the entire TDD experience, with tests passing every few minutes. But unlike “regular” TDD, it doesn’t just work. We need to prepare and plan a bit before we can harness of the power of TDD in our real-world applications. In this session, I’m going to go step by step of building APIs from scratch, including the thinking of what to do next. I’ll be using small steps, and show you where I backtracked and made changes. At the end we’ll have working APIs, with tests that prove that they work. TDD is not just for unit tests anymore.