将NUnitTesting GUI集成到Visual Studio 2012中并调试测试用例 [英] Integrating NUnitTesting GUI to Visual studio 2012 and debugging Test Cases

查看:111
本文介绍了将NUnitTesting GUI集成到Visual Studio 2012中并调试测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将NUnit 2.5用作Visual Studio 2012 Professional的单元测试框架. 我将NUnit.exe配置为打开NUnit GUI来测试我的dll.

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.

我正在测试一个名为"BookStore.dll"的dll,该dll是通过编译当前的类库项目"BookStore"生成的

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

要将nunit配置为我的测试框架,我在BookStore库项目属性窗口中设置以下值:

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

启动外部程序:C:\ Nunit \ Nunit.exe

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

命令行参数:BookStore.dll

Command line arguments : BookStore.dll

工作目录为:C:\ Projects \ BookStore \ Bin \ Debug \

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

我在nunit.exe.config中设置以下配置值

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

在配置标签下:

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

在运行时标签下:

 <loadFromRemoteSources enabled="true" />

现在,我将启动项目设置为该库项目,然后按F5键. NUnit打开,我能够选择项目和测试方法,并且能够运行并查看所有测试结果.

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.

到目前为止很好:

但是问题是,当我在BookStore项目中的任何测试方法中设置一个断点时,该断点都没有被击中.

有人可以帮我在这里我想念什么吗??

注意:我使用以下博客配置了此单元测试: http://blog.toddbauer.me/2011/02/17/debugging-net-nunit-tests-in-visual-studio/

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

推荐答案

我尝试直接运行F5而不是直接按F5并运行测试项目":

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

  1. 在需要的地方放置一个断点.
  2. 右键单击测试"项目->调试"->启动新实例".

然后,当我选择合适的测试方法并运行时,这使我能够达到断点.

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

现在可以使用.

这篇关于将NUnitTesting GUI集成到Visual Studio 2012中并调试测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆