[erlang-questions] how: Mock processes in a test setup

Zvi <>
Thu Apr 3 02:03:03 CEST 2008


I also interested in this subject. I'm not an expert, but I think that
standard way to implement mockups/stubs/simulations in Erlang it's using
callback modules, especially in OTP.
I.e. suppose you have gen_fsm process controlling some fancy hardware. The
hardware is not available yet, so you write mockup gen_fsm callback module:  
fancy_hw_sim . When actual hardware is available, you write   fance_hw_real 
callback module.  Then you either put callback name into define or choose it
at runtime at start / start_link .


Christian S wrote:
> Hi, I'm looking at a java testing tool called EasyMock. It allows you
> to create an object that adheres to a java interface, but set it up to
> what calls (their order) it should expect, then throw it into a test
> scenario to see if expectations are met.
> http://www.easymock.org/EasyMock2_3_Documentation.html
> I wonder, have someone attempted to implement something similar in Erlang?
> _______________________________________________
> erlang-questions mailing list
> http://www.erlang.org/mailman/listinfo/erlang-questions

View this message in context: http://www.nabble.com/how%3A-Mock-processes-in-a-test-setup-tp16453117p16454917.html
Sent from the Erlang Questions mailing list archive at Nabble.com.

More information about the erlang-questions mailing list