Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Specify order of execution of NUnit methods

Posted on 2011-10-12
Medium Priority
Last Modified: 2012-05-12
In the NUnit test class I have 4 methods Insert,  Select, Update, Delete. But the order of execution is not in ther order what I mentioned in the class. The Delete method is getting executed first. This create problem for me. I want to force the order of execution of the methods. Any way to achieve that? I googled but no luck.

Any help is much appreciated. Thanks.
Question by:Easwaran Paramasivam
  • 2
LVL 75

Accepted Solution

käµfm³d   👽 earned 750 total points
ID: 36960306
From what I read, NUnit "chooses" the order of execution based on alphabetic ordering--because this is how Reflection returns the methods. You can give your methods names that are lexically in the order you want them to run (e.g. a_Insert, b_Update, c_Delete, etc.). It seems the philosophy for not allowing the explicit ordering of tests is that each test should be a distinct and self-contained unit, and as such should not depend on another test.
LVL 16

Author Comment

by:Easwaran Paramasivam
ID: 36960324
Thanks for your comments. Is there any other way such as mentioning the order of the execution in any of the attribute? Because we follow the naming convention to methods.

Expert Comment

ID: 36960518
I have checked but there is not other way, I think what kaufmed says is the  only way.
LVL 16

Author Closing Comment

by:Easwaran Paramasivam
ID: 36960544
I'll follow your comments for workaround. Thanks.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question