我可以调试在运行VS单元测试? [英] Can I debug while running a VS Unit Test?

查看:296
本文介绍了我可以调试在运行VS单元测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想单元测试,使用自定义事件的一个用户组件。在做这个的时候不使用VS单元测试框架Debug.Assert的成功,做同样的事情与VS单元测试框架的时候,断言失败,这是不符合逻辑的,所以我想在做单元测试与VS框架进行调试。但似乎我不能因为code从不暂停在我设置的调试点。

I want to unit test a user component which use custom events. when doing this without using VS Unit test Framework debug.assert succeed, when doing the same thing with VS Unit Test Framework, assert fails this is illogical so I want to debug while doing Unit test with VS framework. But It seems I can't because code never pause at debug point that I set.

那么,有没有一种方式,迫使它在调试点暂停在这种情况下?

So is there a way to force it to pause at debug point in that case ?

更新:我的意思是不是在运行测试项目的测试项目本身,而是在目标项目

Update: I mean not in the Test Project itself but in the Targeted Project while running the Test Project.

推荐答案

由P.坎贝尔答案是不完全正确的。如果你开始调试项目(如WCF服务的网站),就不可能启动任何单元测试,调试模式或没有。这样做的选项只是变灰的Visual Studio 2012。

The answer by P. Campbell is not exactly right. If you start debugging a project (such as a WCF services site), it is impossible to start any unit tests, debug mode or not. The options to do so are simply grayed out in Visual Studio 2012.

这意味着你根本无法从单元测试调试外的过程code。您只能调试code,它是直接由单元测试调用过程。

This means you simply cannot debug out-of-process code from a unit test. You can only debug code that was directly called in process by the unit test.

这是在VS2012的一个主要问题,他们现在需要解决。

This is a major problem in VS2012 that they need to fix now.

这篇关于我可以调试在运行VS单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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