473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

NUnit Test cases execution

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
3 11160
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

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
Andy,

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

Aug 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter Rilling | last post by:
My development team is using VS.NET with VSS integration. They are able to check in and out from within VS.NET. We also use NUnit for testing our libraries. Currently our entire solution is...
1
by: Udi | last post by:
Hi, I'm new to NUnit and C#. I've created a list of tests for my module and everything works fine. However, there are several tests that depend on other, and must be run after them. is it possile...
3
by: Julia | last post by:
Hi, We are going to invest in testing and I wonder are there any guidelines to design NUnit friendly classes? Should I consider at all ease of use in unit testing when designing my classes? ...
1
by: Frank Rizzo | last post by:
I am trying to figure out NUnit. I've seen some blogs where people swear by it. I can't figure it out. What is its purpose? And I am not sure how to make it work once it is installed. I...
2
by: Ray Cassick \(Home\) | last post by:
I have started using this on a regular basis and have a question regarding conditional compilation. I have all my test cases wrapped in an #if/#endif that checks to see if the build is debug or...
3
by: JJ | last post by:
Hi, In Nunit testing with asp.net are you guys creating a separate Test assembly for testing or integrating right in class themselves? Is anyone using a third party Unit Test addon for Nunit to...
6
by: Ray Tayek | last post by:
hi, i am preparing to teach a class in c++ and would like to intoduce some unit testing. i can make unit tests in c# using this dll and nant from the command line. i am using visual c++ 2005...
0
by: Anbu | last post by:
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...
5
nikpreek
by: nikpreek | last post by:
Hi All, This is my first post, I've been finding lots of solutions from this forum. Thanks to all who helped (and ones who asked questions). I have a strange problem. I'm having a console app and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.