NUnit Test cases execution

A

Anbu

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.
 
A

Andreas Mueller

Anbu said:
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
 
D

dodger_web

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 :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top