Is it common to write integration tests before writing unit tests? Is it conventional, a good idea, or best practice?
It just seems like a logical thing to do in my mind, especially when working with some 3rd-party API for the first time: You need to know how to use the 3rd-party software before you can test your own code for proper interaction with 3rd-party software–i.e., you have to test your understanding of how to interact with 3rd-party API’s (via integration tests) before you can test your code for proper use (via unit tests that mock away the 3rd-party API), correct?
Am I on the right path?
EDIT
Thank you all for your answers. I just posted a similar / related question.
When tasked with developing against a third party API, the first thing I do is code a prototype (integration test, if you will) to obtain the expected / desired result. I then create some unit tests that enforce that expectation and refactor the prototype into the actual code I will use moving forward.
So yes, IMO, it’s pretty typical. It may not be TDD in the purest sense, but I’m OK with that.