| || |
How to mock up interfaces?
I hope someone can help me with this issue.
We have to test a complete order cycle. But not all of the business partners do have test interfaces.
And in the order cycle there are a lot of interface moments to check. Sometimes based on SOAP or just a file (FTP, mail...).
To check stock, provisioning electronics, etc. There has to be a response or the order cycle stops...
So the tool we are looking for should provide us with a possibility to make a mockup interface and then sends back pre programmed responses. If so someone is able to test a complete order from start to end, including feed back from all interfaces.
(Is Testcomplete the tool to use in this case?)
A common technique is to write your own intercepting proxy. It intercepts the calls to the service, and returns the responses you want. https://mitmproxy.org/doc/scripting/libmproxy.html
Originally Posted by FrankLeith
Another technique is to use dependency injection at the data layer and funnel things through a data adapter. Then from there substitute a mock adapter that talks to your test fixture code.
Mock is specific term used for unit testing where a library uses reflection to intercept calls and inject objects that you can program a behavior. What you may be thinking is an emulator or proxy injection. There's also a notion of 'spy' that basically keeps counters of actions so you can also see if the class that got injected interacted with the object in a specific way. You may be thinking of proxy/interception or emulator. Where one basically sits between two entities and can either spy or modify calls OR emulator where you can emulate a behavior of an external entity.