Monday, September 25, 2006 1:08 PM
by
mitchell
NUnit Order of Test calls
Apparently, Nunit runs the tests in alphabetical order by test name. I thought I was being smart by saving off references to the Ids and such. That’s OK, workaround number one: write test functions this way if you want them executed in a defined order:
[Test()]
Test1AddArticle()
[Test()]
Test2UpdateArticle()
[Test()]
Test3RemoveArticle()
Normally, the Remove test would be called before the Update test since, of course, R comes before U. This way, I can control the order of execution. Unless, of course, any of you have a better idea?
UPDATE: Some helpful person (my friend, Jeff of IOpine) already recommended that I simply use the [Setup()] and [TearDown()] attributes for the appropriate methods. My first impulse was to say that it's actually more work that way. Not sure though.