[Answered ]-Test Driven Development for REST API

2👍

The idea behind test driven development is that you write the tests first, but that they fail initially. Then, as you actually write correct implementations, the tests start succeeding.

In this case, you’d write tests that would call put, get, post, and delete. Obviously none of them would work at first. Then, once you implemented, say, put correctly, that test would start succeeding, etc.

Now, depending on what level you are writing the tests at, you may need to write enough of your API to get the tests to compile. However, it’s okay if the API has no implementation and throws errors for everything at first.

0👍

You write specifications, that is, you write the method declarations first, and imagine what those APIs do, and don’t implement it at the first place. Instead, you write down your imagination about how it should work from the view of the outside world.

Leave a comment