![]() |
The following is Kostas Tzoumas' description of use of NUNIT together with Visual Studio and C# Express. Updated October 2008 by Kurt Nørmark.
This describes how to run NUnit together with Visual Studio or Visual C# Express and solve an annoying bug. The following have worked under Visual Studio 2005, Visual C# Express 2005 and NUnit 2.4.3 under Windows XP. In 2008 it has been tested with Visual C# Express 2008 and NUnit 2.4.8. ** Visual Studio 2005/2008 or Visual C# Express: -You have to create a project which is either a Class Library or a Console Application File -> New Project -> ... - Add your classes by Project -> Add Class. We assume that you have a class to be tested and a class with the tests (which is using NUnit.Framework). None of them should have a Main method - Add a reference to nunit.framework by Project -> Add reference and select nunit.framework in the window that appears. References are added in the Solution Explorer pane. - ONLY IF your project is a Console Application add a Main method that does nothing (static void Main (string [] args) {} ) in the class which contains the tests! - Build. This should succeed ** In NUnit: I assume that your project is under My Documents\Visual Studio 2005\Projects\Project1 and is named Project1 Tools -> Options... and check the "Enable Visual Studio support" in the window which appears. You find the check box in IDE Suppoort > Visual Studio. File -> Open Project and go to My Documents\Visual Studio 2005\Projects\Project1 - ONLY IF you are using Visual Studio click on the Project1.sln file. Clicking a .dll or .exe file WON'T WORK - ONLY IF you are using Visual C# Express click the .dll or .exe file of the test class. - You find this file in the bin directory, either in Debug or Release. - It is important that you open the dll or exe file which represents the test class.
Thank you to Kostas for this insight!
Kurt Nørmark
Genereret:
Mandag
27. Juli 2009,
12:03:05
Programmeret af Kurt Nørmark med brug af LAML teknologi |
Dat1 SW3 |