[TIP] alphabetical order in testing

Olemis Lang olemis at gmail.com
Tue Jan 19 12:35:11 PST 2010


On Tue, Jan 19, 2010 at 3:26 PM, Alfredo Deza <alfredodeza at gmail.com> wrote:
> Hi
>
> I am aware that test methods are executed in alphabetical order.
>
> What would be the ideal/preferable way of dealing with methods that depend
> in the order they are being executed?
>
> Given that:
>
>> class TestFiles(unittest.TestCase):
>>
>>     def test_second_file(self):
>>         """I depend on z_file"""
>>
>>     def test_z_file(self):
>>         """I should run before second_file"""
>
>
> Would it be OK to alter the naming in the methods to make sure they are run
> in the order I need to? Even if the naming gets really weird like:
>

Very bad practice ! Dependencies between test cases can lead to
fragile tests . TCs should be as isolated as possible
;o)

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
New! Writing doctests for Trac plugins WAS: [Trac] Re: Writing ...  -
http://feedproxy.google.com/~r/TracGViz-full/~3/_wCvZJTu--s/msg00152.html



More information about the testing-in-python mailing list