[erlang-questions] EUnit quirks
Sun Jul 16 11:50:56 CEST 2017
1: A setup function is assumed to either succeed, with a possibly modified
world as result, or fail, with an unchanged world as result. If you need to
make multiple changes, the idea is that you either write separate
setup/cleanup functions for each change and nest them to create a complete
setup, or you write a single setup function that does its own internal
catching of errors and partial cleanup.
2. All exceptions in a test case should be handled the same by eunit.
Asserts are just one way of throwing an exception. Do you have an example
to demonstrate what you are seeing?
2017-07-14 18:45 GMT+02:00 Gareth Adams <>:
> I've been writing some eunit tests using fixtures (
> http://erlang.org/doc/apps/eunit/chapter.html#Fixtures) and have noticed
> a couple of quirks.
> 1. If the setup fails for some reason cleanup is not called. This can be
> an issue if you're mecking things as the don't get unmecked so the next
> test setup fails etc. I find myself lost in a cascade of failures, not
> knowing which tests are really failing.
> 2. If something fails in the test itself that's not part of an assert,
> eunit cancels the tests and they are not run. Although this is reported in
> the console, if you have a lot of tests with debug statements this can be
> lost. The only thing that indicates that they've not been run is the number
> of tests decreases, which au not be noticed.
> Has anyone else had these issues? If so, how did you handle them?
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions