Assuming Data Structures In TDD

Yesterday I made the mistake of assuming the data structure of an API in my unit tests. It was the wrong assumption and meant the code didn’t work with the API; but my tests passed.

How?
I was writing tests for logic that handles API data, but I couldn’t let the tests connect to the API as it is very slow. So I mocked the data with a fake info provider class which was suppose to mimic the data. The tests were passing with the wrong data structure (which I did not know was wrong). So I thought I was in the clear, until the code actually connected to the API and failed.

What did I learn?
In this situation, I should of spiked first so I could understand how the API worked. Then I could delete the code and then re-write the code but this time with TDD.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.