简体   繁体   中英

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?

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!

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

You can use the nUnit runner (GUI - nunit.exe in the bin folder, Console - nunit-console-x86.exe) which comes with nUnit I believe.

Alternatively, if you have resharper ( http://www.jetbrains.com/resharper/ ) installed, it has a test runner.

There is also TestDriven.Net ( http://www.testdriven.net/ )

I haven't seen this demo, but it sounds very much like he is using Resharper .

If you ran the msi installer, it will have installed the NUnit GUI runner. If you browse your start menu its likely under Programs -> Nunit. From the GUI runner you can load your test assembly by navigating to the bin directory of your project.

您必须使用1)Nunit命令行或2)Nunit GUI打开DLL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM