Integrating NUnitTesting GUI to Visual studio 2012

2020-04-22 10:27发布

问题:

I am using NUnit 2.5 as my unit testing framework for visual studio 2012 professional. I configured NUnit.exe to open NUnit GUI for testing my dlls.

I am testing a dll called "BookStore.dll" which i generated by compiling my current class library project "BookStore"

To configure nunit as my testing framework i set the following values in the BookStore library project properties window:

Start External program: C:\Nunit\Nunit.exe

Command line arguments : BookStore.dll

working directory as : C:\Projects\BookStore\Bin\Debug\

i set the following configuration value in the nunit.exe.config

under configuration tag:

 <startup>
    <supportedRuntime version="v4.0" />
  </startup>

under runtime tag:

 <loadFromRemoteSources enabled="true" />

Now i set the start project as this library project and hit F5. NUnit opens and i am able to select the project and test methods and i am able to hit run and see all the test results.

So far so good:

but the problem is when i put a break point in any of the test method in the BookStore project, that break point is not hitting.

Can anybody help me what am i missing here.?

Note: i configured this unit testing using this blog: http://blog.toddbauer.me/2011/02/17/debugging-net-nunit-tests-in-visual-studio/

回答1:

Instead of directly hitting F5 and running the Test Project, I tried to run the project as this:

  1. Put a breakpoint where ever needed.
  2. Right click the Test project -> Debug -> Start new instance.

and then when i choose that appropriate test method and hit run, that enabled me to hit the breakpoint.

It works now.