Named unittests
Atila Neves via Digitalmars-d
digitalmars-d at puremagic.com
Tue Mar 31 14:16:10 PDT 2015
I already have a library that finds all unittest blocks (as well
as its own) and names them by appending a monotonically
increasing integer to mymodulename.unittest. I've been thinking
of using a UDA to decorate unittest blocks so that they show up
with that instead but never got around to it because I don't
really use unittest blocks and nobody is asking for the feature.
It'd take 30min to add though.
Obviously 1st class support would be preferable, I like the
unittest nameGoesHere {
//...
}
that was mentioned later in the thread.
Atila
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
More information about the Digitalmars-d
mailing list