For Java: http://freeside.co/betamax/
For C++, here's someone's homegrown solution: http://www.codeproject.com/Articles/381622/Unit-test-and-the-man-in-the-middle
Pergunta
I am completely new to unit testing/integration testing. I have read that unit tests should use mocks when interacting with external systems, but it seems a lot of manual work.
For external systems I mean:
This external system is not always available as it depends on another company. Nevertheless, I want to test my application many times even if not all the external systems are available.
I am thinking of a framework (for Java and/or C++) that does the following:
If my application (in the "replay" phase) calls the same methods it called the first time (the "record" phase) it should get the same results.
Does such a framework exist? If not, what alternative would you suggest?
I have implemented simulators for many external systems but it doubles my work. For example in the case of serial protocol I have to implement my "client" and also a simulator for the "server". I wonder if there's a way to avoid reinventing the wheel every time.
Solução
For Java: http://freeside.co/betamax/
For C++, here's someone's homegrown solution: http://www.codeproject.com/Articles/381622/Unit-test-and-the-man-in-the-middle