[英]How to run tests while debugging
I've been using ReSharper test runner in Visual Studio for quite a while, and there is one thing about it that I can't figure out. 我一直在Visual Studio中使用ReSharper测试运行器已经有一段时间了,有一点我无法弄清楚。
I used to have some integrational tests in my solution that performed web requests to my local web server. 我曾经在我的解决方案中进行了一些集成测试,这些测试向我的本地Web服务器执行了Web请求。 I used to be able to launch my web application in debug mode, then launch a test with Resharper test runner within the same Visual Studio instance (that was currently running a debug session), and the test would run normally.
我曾经能够以调试模式启动我的Web应用程序,然后在同一个Visual Studio实例(当前正在运行调试会话)中使用Resharper测试运行器启动测试,并且测试将正常运行。 The breakpoints in my application were hit, and I was able to debug the requests sent from the test.
我的应用程序中的断点被击中,我能够调试从测试发送的请求。
However, when I was trying to do the same thing for a new project, the tests fail to launch. 但是,当我试图为新项目做同样的事情时,测试无法启动。 When I run any test, Visual Studio displays a modal window asking
Do you want to stop debugging?
当我运行任何测试时,Visual Studio会显示一个模式窗口,询问
Do you want to stop debugging?
. 。 Why am I unable to run tests while having an active debugging session anymore?
为什么我在进行活动调试会话时无法运行测试? What does the ability to do this depend on?
这样做的能力取决于什么? Visual Studio version?
Visual Studio版本? Resharper version?
Resharper版本? Unit testing framework (I'm currently using MSTest)?
单元测试框架(我目前正在使用MSTest)?
I think I've seen this behavior before, it seemed to be driven by the fact that Resharper was feeling the need to always build my project/solution before running tests. 我想我以前见过这种行为,似乎是因为Resharper感觉需要在运行测试之前总是构建我的项目/解决方案。
Try changing the Build Policy to Never (at first at least) from the Unit Test Sessions window: 尝试从“单元测试会话”窗口将“构建策略”更改为“从不(至少起初)”:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.