[erlang-questions] Unit testing code - whence?
Wed Jul 6 07:33:34 CEST 2011
Unit tests in a different module means you have to open your module up a lot
more than if the tests are in the same module.
Generally, I write the code, then I include_lib eunit.hrl, then I write the
unit tests. That can all be wrapped in conditional compilation if you need
to. However, when just developing new functions, I typically put the tests
right by the functions they're testing, and only when I'm done do I move
them to the end of the file.
Works for me/us! Your mileage may vary.
Americans might object: there is no way we would sacrifice our living
standards for the benefit of people in the rest of the world. Nevertheless,
whether we get there willingly or not, we shall soon have lower consumption
rates, because our present rates are unsustainable.
On Tue, Jul 5, 2011 at 2:27 PM, Alex Arnon <alex.arnon@REDACTED> wrote:
> Hi List,
> What are the conventions regarding placement of unit test code and
> I tend to generate a lot of unit tests - 2x..4x SLOC of the tested module's
> 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?
> 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_().
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions