testing units in a specific order?
apardon at forel.vub.ac.be
Tue Jan 10 03:29:34 EST 2006
Op 2006-01-09, Tim Peters schreef <tim.peters at gmail.com>:
> [Antoon Pardon]
>> I have used unit tests now for a number of project. One thing
>> that I dislike is it that the order in which the tests are done
>> bears no relationship to the order they appear in the source.
>> This makes using unit tests somewhat cumbersome. Is there some
>> way to force the tests being done in a particular order?
> They're run in alphabetical order, sorting on the test methods' names.
> For that reason some people name test methods like 'test_001',
> 'test_002', ..., although unit tests really "shouldn't" case which
> order they get run in.
Well maybe unit tests shouldn't care (Thats what I think you meant),
I care. Some methods are vital for the functionality of other methods.
So it the test for the first method fails it is very likely a number of
other methods will fail too. However I'm not interrested in the results
of those other tests in that case. Having to weed through all the test
results in order to check first if the vital methods are working before
checking other methods is cumbersome.
Having the vital methods tested first and ignore the rest of the results
if they fail is much easier.
More information about the Python-list