简体   繁体   English

Visual Studio:在单个项目中运行所有测试?

[英]Visual Studio: Run all tests in a single project?

In my Visual Studio solution, I have about a dozen projects, several of which contain unit test methods (tagged with the TestMethod attribute), with several hundred test methods spread across those projects. 在我的Visual Studio解决方案中,我有大约十几个项目,其中几个包含单元测试方法(用TestMethod属性标记),并在这些项目中分布了数百个测试方法。

From within Visual Studio, I'd like to run all of the (100+) tests in one particular project in the solution, without running the tests in the other projects in the solution. 在Visual Studio中,我想在解决方案中的一个特定项目中运行所有(100+)测试,而不在解决方案中的其他项目中运行测试。

Ctrl + R , A doesn't do what I want, since that runs all tests in the entire solution. Ctrl + RA不能做我想要的,因为它在整个解决方案中运行所有测试。 I also don't see any options to run tests in a particular project in the Test menu, in the Test Explorer window, or in the right-click context menu for a project in the Solution Explorer window. 我也没有看到任何选项在“测试”菜单,“测试资源管理器”窗口或“解决方案资源管理器”窗口中项目的右键单击上下文菜单中的特定项目中运行测试。

I'm using Visual Studio 2013. 我正在使用Visual Studio 2013。

What's the best way to get Visual Studio to run all of the test methods in a particular project? 让Visual Studio在特定项目中运行所有测试方法的最佳方法是什么?

After some additional poking around the UI, I figured out a decent way to do this: 在围绕UI进行一些额外的讨论后,我想出了一个很好的方法来做到这一点:

  1. Open the Test Explorer window. 打开Test Explorer窗口。 (Test menu > Windows > Test Explorer) (测试菜单> Windows>测试资源管理器)
  2. Click on the little down arrow just to the left of the search field. 单击搜索字段左侧的小向下箭头。
  3. From the context menu that appears, select Project. 从显示的上下文菜单中,选择“项目”。 The Test Explorer window contents change to be grouped by project in a 2-tier hierarchy. 测试资源管理器窗口内容将更改为按项目在2层层次结构中进行分组。

Test Explorer过滤器菜单

  1. Right-click on the desired project. 右键单击所需的项目。
  2. From the context menu that appears, click Run Selected Tests. 从显示的上下文菜单中,单击“运行所选测试”。

Test Explorer项目上下文菜单

I'd still like a reasonable way to do this with only the keyboard, though! 不过,我仍然想用一种合理的方法只使用键盘来做到这一点!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM