parametrized modules and unit testing
pietje
pieter.rijken@REDACTED
Mon Feb 22 10:28:45 CET 2010
I'm quite new to Erlang and probably don't understand fully some of
the concepts.
I want to write unit tests (using eunit) for a module without being
dependent on the implementation
of other modules that it uses.
Suppose I have 2 modules, say ma and mb, and that module ma uses
(imports) module mb.
I'm trying to figure out in Erlang how to write unit tests for module
ma that do not depend on the particular
implementation of functions in module mb.
The idea is that I want to be able to change the behaviour of
functions in mobule mb while at the same time
keeping the API unchanged in such a way that the unit tests for module
ma do not change.
In Java I was used to solving this using dependency injection
techniques (using the factory pattern and mocked
objects).
Up till now in Erlang I was using parametrized modules to this end by
passing a module as one of the parameters.
But considering the discussion in other threads, I'm looking for
alternatives.
Does anyone have suggestions or explain how this is normally done in
Erlang?
many thanks, pieter
More information about the erlang-questions
mailing list