I’m currently losing the will to live with integration tests for an http service I’m writing.
It calls out to other services (often 3 or 4 external api calls for each of my http resources, each with complex data structures).
(I just want the external API data in a database!)
Tests are a pain because of the matrix of fixtures needed. My API endpoints behave very differently based on the attributes of the objects in the response from the other APIs. So I have lots of somewhat complex code to generate fixture data, which again is another source of error and a whole lot of code.
For one of my endpoints, I have to mock 1-6 API calls, multiplied by 3 or 4 variations of the returned data. It’s torture.
None of my tests are that obvious what it’s testing because the fixture code and json assertions are so big and long. We aren’t using an http mocking lib right now (eg wiremock) but I’m wondering if it’s worth it.
I guess a lot of it is because the APIs I’m calling are so badly designed.