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.<div><br></div><div>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.</div>
<div><br></div><div>Works for me/us! Your mileage may vary.</div><div><br></div><div>Sincerely,</div><div><br></div><div>jw</div><div><br clear="all"><br>--<br>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. <br>
<br>
<br><br><div class="gmail_quote">On Tue, Jul 5, 2011 at 2:27 PM, Alex Arnon <span dir="ltr"><<a href="mailto:alex.arnon@gmail.com">alex.arnon@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div dir="ltr">Hi List,<br><br>What are the conventions regarding placement of unit test code and invocation?<br>Considerations:<br>I tend to generate a lot of unit tests - 2x..4x SLOC of the tested module's code is not uncommon.<br>

Should the unit test functions be placed in their own module? <br>If so - what is the naming convention for the new modue: 'test_mymod' / 'mymod_test' or something else?<br>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_().<br>

<br>Cheers,<br>Alex.<br><br><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>