[Haskell-beginners] Where do you put your tests?
damodar kulkarni
kdamodar2000 at gmail.com
Thu Jul 19 15:27:10 CEST 2012
> Good because library dependencies are reduced, but bad because tests are
> somewhat "disconnected" from the functions they are testing.
AFAIK, it's a good engineering practice to separate the tests from the code
they are supposed to test. Code management issues will be there, but those
can be taken care with the help of cabal like tool.
That way, a person who wants to test will use the test-files and the one
who doesn't want will be spared the trouble of separating tests from the
intended function code.
Regards,
Damodar
On Thu, Jul 19, 2012 at 1:46 PM, Lorenzo Bolla <lbolla at gmail.com> wrote:
> Hi all,
>
> I'm writing some library code and I have hunit-tests and quickcheck-tests.
> I'm facing the problem of where to put these tests. These are the options I
> can think of:
>
> - Put the tests for a function in the same file where the function is
> defined. This is good because tests are close to the code being tested and
> work as a sort of documentation for it. But it's bad because the file
> requires HUnit, QuickCheck, Test.Framework, etc. to compile.
> - Same as above, but use some sort of preprocessing flag to ignore the
> Test suite when compiling the library (hence no dependencies on test
> libraries), but leave the code in place. No dependencies, but ugly.
> - Put the tests in completely separate files. Good because library
> dependencies are reduced, but bad because tests are somewhat "disconnected"
> from the functions they are testing.
>
> What do you expert suggest? How should I organize my test suites?
> (The same conundrum applies to benchmarking code.)
>
> Thanks,
> Lorenzo
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120719/4058cde5/attachment.htm>
More information about the Beginners
mailing list