Named unittests

ezneh via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 31 02:06:28 PDT 2015


On Monday, 30 March 2015 at 21:52:35 UTC, Andrei Alexandrescu 
wrote:
> We're having a strong need for named unittests at Facebook for 
> multiple reasons.
>
> 1. We have sophisticated tooling that verifies whether 
> unittests are flaky. The automated monitor (for e.g. C++) 
> figures whether a given unittest fails several times across 
> several commits. Unittests are identified by name; relying on 
> file/line is impossible because the line of a failure is not 
> stable across changes.
>
> 2. Again for efficient automated testing and flakiness 
> detection, one should be able to run only a subset of unittests 
> by mentioning them by line in the command line. Note that this 
> implies there's no interdependency between distinct unittests, 
> which is fine because the new ability is opt-on; I'd say is 
> pure style anyway.
>
> 3. Mentioning unittest names in failure messages helps human 
> communication (e.g. "AddPeer is failing after your change"). 
> This is impossible with file and line numbers.
>
> I'd like to make a DIP for named unittests. Who can help me 
> with that?
>
>
> Andrei


Would it be doable to make something like

unittest("Say my name") {
  // tests
}

and still be backward compatible ?

In the other hand, other proposed solutions seem to be good imho.


More information about the Digitalmars-d mailing list