Hack to name unit tests?

Christopher Wright dhasenan at gmail.com
Fri Nov 30 05:46:02 PST 2007


Daniel Keep wrote:
> 
> Christopher Wright wrote:
>> ...
>> There are advantages to throwing an exception when registering the name:
>>
>> unittest {
>>    testName("this is the test that doesn't end");
>>    while (true) {}
>> }
>>
>> I was thinking that AssertionErrors couldn't be caught, but that was an
>> error on my part.
> 
> How is an exception an advantage in that case?  When you run the test,
> it's still going to spinlock, no matter how you've obtained the name.
> 
> If what you're trying to get at is that you can build a list of all the
> names without having to run the actual test itself, then yes, I can see
> that being an advantage.

Exactly, exactly! Precisely what I told Miss Chow. Tissue augmentation, 
it's not a matter of twiddling bits.

On a more serious note, tools like the XUnit test runners display a list 
of names without running the tests. That's convenient, I think. The 
NUnit gui takes about twenty seconds to find all the unit tests we have 
at work, and it takes two or three minutes to run the tests. If I want 
to check a single test, two or three minutes is a long time.

> 	-- Daniel



More information about the Digitalmars-d mailing list