Andrey
Andrey

Reputation: 590

How to make Visual Studio throw exceptions into the NUnit gui?

I'm new to C# and I am confused with the way NUnit and Visual Studio interact regarding exceptions.

From using it before, I remember that exceptions were thrown into the NUnit Gui "Errors and failures" tab, making the tests red - that is what I need now.

Now even Assert.Fail returns me to the VS window.

My setup is:

namespace Launcher
{
    class Launcher
    {
        [STAThread]
        static void Main(string[] args)
        {
            NUnit.Gui.AppEntry.Main(new[] { "MainProject.dll" });
        }
    }
}

I know that I can open NUnit and then my dll and it will show exceptions inside NUnit window.

What I want is to press Debug and have NUnit to execute tests that I select, throw exceptions into NUnit window and make me able to set breakpoints - that worked before!

Upvotes: 1

Views: 410

Answers (1)

Lareau
Lareau

Reputation: 2011

Open up Nunit, Go to File --> Open project Navigate to the .dll of your unit test project, this should open up all your tests.

From here you can run all the test etc. You can setup nunit to run test everytime you rebuild your project (so ctrl-shift-b). No need to always press the debug button.

If you want to debug your test, (in vs2010), go to debug --> attach to process --> select nunit-agent.exe,
that should allow you to hit your breakpoints.

Upvotes: 4

Related Questions