[erlang-questions] Unit testing code - whence?
Tue Jul 5 23:47:51 CEST 2011
On Wed, Jul 6, 2011 at 12:34 AM, Bob Ippolito <bob@REDACTED> wrote:
> On Tue, Jul 5, 2011 at 2:27 PM, Alex Arnon <alex.arnon@REDACTED> wrote:
> > What are the conventions regarding placement of unit test code and
> > invocation?
> > Considerations:
> > I tend to generate a lot of unit tests - 2x..4x SLOC of the tested
> > code is not uncommon.
> > Should the unit test functions be placed in their own module?
> > If so - what is the naming convention for the new modue: 'test_mymod' /
> > 'mymod_test' or something else?
> Yes. The convention is to place them in test/mymod_tests.erl. These
> will get picked up by rebar eunit.
> > What is the preferred way, if there are many small UT functions: function
> > *_test() per UT, or separate into test sets by group, e.g.:
> > api_unit_test_(), internal_unit_test_().
> I don't think there is as much consensus for this. I do whatever makes
> sense at the time. I don't try and group tests together unless it's
> easier to write the code that way (e.g. with a list comprehension, or
> if they share the setup/teardown in a foreach).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions