Failed unittest

Jacob Carlborg doob at me.com
Mon Aug 20 04:48:04 PDT 2012


On 2012-08-20 11:51, monarch_dodra wrote:
> I find unittests to be a very very useful too in D. However, one of the
> things that I am seeing is that it does not scale very well (Phobos in
> mind), as the tests stop as soon as the first failure. Heck compilation
> stops at the first unittest compilation failure.
>
> This is bad because:
> a) In a large scale project, there are always some things that are broken
> b) There is no way to pre-emptivelly write a "failing" unit test, while
> waiting for a known bug to be fixed.
>
> The end result are tests that are not as aggressive as they could be, or
> things that are not covered, because they did not initially work due to
> some bug somewhere else, and nobody writing the test once said bug was
> solved...
>
> I'm wondering if:
> 1) Would it be possible to compile "as many unittests as possible", and
> simply omit the tests that static assert? This would create a "unit test
> compilation failure", but not prevent the tests that *did* compile from
> moving on to the run-time testing.
> 2) Would it be possible to execute ALL unit tests, even after one fails?

The intention is that the unit tests will be changed so it continues 
after a failed unit test. This is either per module or per unit test block.


A temporary solution is to implement a library solution. For example:

https://github.com/jacob-carlborg/orange/blob/master/orange/test/UnitTester.d

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list