本文介绍了VS2012 不运行单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几周前,我在进行单元测试,它们按预期构建和运行.

A couple of weeks ago I was working on unit tests, they were building and running as expected.

我去度假了一个星期,今天早上启动了我的机器,没有对单元测试项目做任何代码更改,测试不再运行.

I went on holiday for a week, booted up my machine this morning, and without making any code changes to the unit test project, the tests no longer run.

当我说测试不再运行"时,我并不是说它们失败了;它们实际上不会运行.

And when I say "the tests no longer run" I don't mean that they fail; they literally will not run.

我已尝试运行或调试特定测试,我已尝试运行或调试所有测试,我已通过每个测试方法名称旁边的 Resharper 图标进行了尝试,我已在 TEST 中进行了尝试菜单项,我已经在单元测试会话"窗口中尝试过它......然后发生的只是单元测试会话"窗口从右侧滑入,所有测试都显示待处理"......然后什么都没有.

I've tried to run or debug a specific test, I've tried to run or debug all tests, I've tried it from the Resharper icon adjacent to each test method name, I've tried it from the TEST menu item, I've tried it from the "Unit Test Sessions" window... and all that happens is that the "Unit Test Sessions" window slides in from the right, all the tests say "Pending"... and then nothing.

输出窗口中也没有消息.

There are no messages in the Output window either.

项目构建没有任何问题.我试过清理解决方案并重建,但这没有任何改变.此外,这不仅仅是我几周前进行的测试,而是我的 UnitTests 项目中的所有测试.

The project builds without any problems. I've tried cleaning the solution and rebuilding, but this changes nothing. Also, it's not just the tests I was working on a couple of weeks ago, it's all tests in my UnitTests project.

同事可以运行测试.他遇到了我没有遇到的各种 Resharper 消息,但他仍然可以运行测试.

A colleague can run the tests. He encounters various Resharper messages that I don't, but he can still run the test.

唯一的区别是我在尝试运行测试之前安装了 VS2012.2 更新.

The only difference is that I installed the VS2012.2 update before I tried running the tests.

有人知道为什么这些测试显然无法运行吗?

Does anyone have any ideas why these tests apparently won't run?

推荐答案

我遇到了同样的问题,Resharper 7.1.3 的更新对我有用.

I was experiencing the same issue, an update to Resharper 7.1.3 worked for me.

更新:在 VS 2012 Update 2 中找到了有关 Resharper 单元测试问题的信息,并在 Resharper 7.1.3 中专门解决了这个问题:http://blogs.jetbrains.com/dotnet/2013/04/resharper-713-is-available-for-visual-studio-2012-update-2/

Update:Found info about the problem with Resharper unit testing in VS 2012 Update 2 and that it was addressed specifically in Resharper 7.1.3: http://blogs.jetbrains.com/dotnet/2013/04/resharper-713-is-available-for-visual-studio-2012-update-2/

这篇关于VS2012 不运行单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:07