Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I created NUnit tests, now how do I run them?

I'm developing in vs2008, c#, .net 3.5.

I downloaded NUnit 2.5 win / msi version. I have created a [TestFixture] Class containing several [Test] methods.

How do I run the tests?

When I run a NUnit demo solution from Ed Ames, his test .cs files have an icon in the grey column to the left of the code (same place where breakpoints, bookmarks, etc show up.) Clicking on the icon gives me an option to run the tests.

That icon is not showing up in my projects. Is there a property I need to set?

Also, the documentation refers to a NUnit GUI that can be used to run the tests. A GUI doesnt seem to have downloaded in the msi version of NUnit. Is there a separate download for the Gui?

like image 582
Lill Lansey Avatar asked Jun 02 '09 19:06

Lill Lansey


People also ask

How do I run a test in Visual Studio?

To run all the tests in a default group, choose the Run icon and then choose the group on the menu. Select the individual tests that you want to run, open the right-click menu for a selected test and then choose Run Selected Tests (or press Ctrl + R, T).

Does SetUp run before every test NUnit?

The SetUp attribute is inherited from any base class. Therefore, if a base class has defined a SetUp method, that method will be called before each test method in the derived class.


2 Answers

Thanks for all your help guys.

I am using resharper, forgot to mention it.

Actually, tests were not running (no tests found in file) because my [TestFixture] class was not Public. Changed it to Public and all my tests showed up.

Also, thanks for your help finding the Gui. I was looking for an exe with GUI in the filename. But I will use Resharper to run the tests. Now that I have found them!

like image 127
Lill Lansey Avatar answered Sep 29 '22 07:09

Lill Lansey


The demo you saw most likely had a VS plug in (Resharper, TestDriven.NET, etc.), which doesn't come with NUnit. However, NUnit installs with a GUI. Go to the folder that you installed NUnit and you will find it there.

The program is called nunit.exe and it's in the bin folder.

Once you start it, you'll need to go to File -> Open Project and find the DLL you built in Visual Studio

like image 33
Joseph Avatar answered Sep 29 '22 07:09

Joseph