Is it wise to defer unit-testing until integration tests pass in scenarios where behavior of a 3rd-party API is largely unknown? -
I do not mean suspend all unit-testing until the integration test is passed. Unit testing I am referring to the things that verify that the SUT contacts correctly with the third-party secret API.
The reasoning for defining these unit tests is that they verify something that is unknown. If I do not know how the third party's secret API works, how can I also write a unit test to ensure that the SUT uses the third party API correctly? Only once a few minimum integration tests are passed, I really know what kind of behavior is to be verified.
Of course, all other unit tests have been written in a normal way (red, green, refractor).
Under the assumption that this is an external API, I argue that your test may be in this form Will not be a unit test anyway. They will be integration tests.
To test your code about writing a fake and then when you can use 3rd party API, about writing proper integration test? In addition, if you are testing the entity's third party content, your build will fail as soon as these things become unavailable, which may be a problem in the long run.
Comments
Post a Comment