Parallel execution of unittests

Jason Spencer via Digitalmars-d digitalmars-d at puremagic.com
Thu May 1 10:41:26 PDT 2014


On Wednesday, 30 April 2014 at 16:19:48 UTC, Byron wrote:
> On Wed, 30 Apr 2014 09:02:54 -0700, Andrei Alexandrescu wrote:
>
>> 
>> I think indeed a small number of unittests rely on order of 
>> execution.
>
> Maybe nested unittests?
>
> unittest OrderTests {
>   // setup for all child tests?
>   unittest a {
>   }
>   unittest b {
>   }
> }

I like my unit tests to be next to the element under test, and it 
seems like this nesting would impose some limits on that.

Another idea might be to use the level of the unit as an 
indicator of order dependencies.  If UTs for B call/depend on A, 
then we would assign A to level 0, run it's UTs first, and assign 
B to level 1.  All 0's run before all 1's.

Could we use a template arg on the UT to indicate level?
unittest!(0) UtA { // test A}
unittest!{1} UtB { // test B}

Or maybe some fancier compiler dependency analysis?


More information about the Digitalmars-d mailing list