If I want to implement a connection from my software to an API, which is documented but not accessible yet, what is a common way to imitate the API until it is available?
My first idea was to mock the HTTP client and conditionally return responses (depending on the request data). But whenever i google for “mocks”, it always involves testing somehow. It feels like, I am on the wrong track. I don’t want to test it. But i want some code, that behaves like the API later. Also i don’t think i should mix test and devlopment space somehow (in my architecture ist strictly separated)
Also: What to do with this temporarly required code? I think it should not go in my codebase, or should it?
On the other side, if I would have this code once, it can be used to be independent from the original API that might be not reachable at any time.
Since tests later on also involves a lot mocking API calls, is there a smart way to “reuse” it?
Any suggestions?
harrow is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.