By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,875 Members | 1,524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,875 IT Pros & Developers. It's quick & easy.

NUnit Test cases execution

P: n/a
Hi All,

I have 5 test cases (b, c, a, d & e) , NUnit picks up the in
alphabatical order. I want to execute the test case e first before the
exection of other function.

Is there any way to execute the NUnit test cases in a particular
sequence?

Thanks in advance.

Aug 18 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Anbu wrote:
Hi All,

I have 5 test cases (b, c, a, d & e) , NUnit picks up the in
alphabatical order. I want to execute the test case e first before the
exection of other function.

Is there any way to execute the NUnit test cases in a particular
sequence?

Thanks in advance.
AFAIK, there is no way. The reason why they are executed alphabetically
is because reflection returns the methods in this order. Executing tests
in a specific order is against the philosophy of unit tests, where each
test should be self contained and independent of the others.

However, one can use a unit test framework to drive larger automated
tests. Here I would recommend the following links. The 3rd article
introduces what you are looking for:

http://www.codeproject.com/csharp/autp1.asp
http://www.codeproject.com/csharp/autp2.asp
http://www.codeproject.com/csharp/autp3.asp
http://www.codeproject.com/csharp/autp4.asp
http://www.codeproject.com/gen/design/autp5.asp

HTH,
Andy
Aug 18 '06 #2

P: n/a

One option could also be to number your test cases.

public void _01_testThat() {}

public void _02_testThatAgain() {}

And so on.

Regards
Andreas Mueller a écrit :
Anbu wrote:
Hi All,

I have 5 test cases (b, c, a, d & e) , NUnit picks up the in
alphabatical order. I want to execute the test case e first before the
exection of other function.

Is there any way to execute the NUnit test cases in a particular
sequence?

Thanks in advance.
AFAIK, there is no way. The reason why they are executed alphabetically
is because reflection returns the methods in this order. Executing tests
in a specific order is against the philosophy of unit tests, where each
test should be self contained and independent of the others.

However, one can use a unit test framework to drive larger automated
tests. Here I would recommend the following links. The 3rd article
introduces what you are looking for:

http://www.codeproject.com/csharp/autp1.asp
http://www.codeproject.com/csharp/autp2.asp
http://www.codeproject.com/csharp/autp3.asp
http://www.codeproject.com/csharp/autp4.asp
http://www.codeproject.com/gen/design/autp5.asp

HTH,
Andy
Aug 18 '06 #3

P: n/a
Andy,

Thanks for the links that you provided. They are really great links

Aug 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.