resharper 测试运行程序 - 如何按类别执行? [英] resharper test runner - how to execute by category?

查看:19
本文介绍了resharper 测试运行程序 - 如何按类别执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Resharper 7.1 版

Resharper version 7.1

Visual Studio 2012 旗舰版

Visual Studio 2012 Ultimate

两部分问题:

Q1:当我在解决方案资源管理器中选择运行单元测试"时,resharper 会自动打开一个测试夹具运行器并执行所有测试夹具.但是,我将测试分为两类:1)长期运行"和 2)短期运行".有没有办法在执行这些步骤后让测试运行程序只执行短期运行"?

Q1: When I select "run unit tests" in the solution explorer resharper automatically opens a test fixture runner and executes ALL test fixtures. However, I have categorized tests in to two categories: 1) "long running" and 2) "short running". Is there a way that after performing these steps that I can have the test runner execute "short running", only?

问题 2:打开测试夹具运行器后,我选择按类别"分组.我看到了我上面提到的两个类别.我右键单击短期运行"并选择运行测试".预期只有短期运行"测试才会执行;但是,长期运行"和短期运行"都会执行.有没有办法按类别执行,并且只执行那个类别?

Q2: With the test fixture runner open, I select Group By "Categories". I see the two categories I mention above. I right click on "short running" and select "run tests". Expected is that only the "short running" tests will execute; however, BOTH the "long running" and "short running" execute. Is there a way to execute by category, and have only that category execute?

更新:这是我屏幕上显示的内容

UPDATE: here is what is showing on my screen

首先:R#->选项->单元测试(常规选项卡)

First: R#->Options->Unit Testing (general tab)

第二:来自随机测试夹具的示例测试,显示用法.

Second: an example test from a random testfixture, showing usage.

第三:这是我从解决方案资源管理器执行运行单元测试"时看到的,也是我右键单击短期运行"->运行测试"(在任何一种情况下,长时间运行")时看到的" 也执行)

Third: this is what I see when I execute "run unit test" from Solution Explorer, and also what I see when I right click on "short running"->"run tests" (in either case, "long running" also executes)

推荐答案

长时间运行的测试真的在运行吗?我知道这似乎是一个愚蠢的问题,但是如果长期和短期运行的测试共享一个测试夹具,则它们看起来可能正在运行,如您发布的屏幕截图所示,但它只是运行的共享夹具,而不是实际运行的夹具测试.换句话说,测试装置在结果树中获得一个节点,如果它被测试共享,它可以在树中出现多次.在夹具运行时,测试运行器不知道将要运行什么测试,因此将树中的所有夹具节点标记为正在运行,尽管只有共享夹具本身在运行.然后它会运行实际的测试,只有运行的测试才会被标记为正在运行.

Are the long running tests actually running? I know it seems like a silly question, but if both long and short running tests share a test fixture, it might look like they're running, as in the screenshot you posted, but it's only the shared fixture that's run, not the actual tests. In other words, test fixtures get a node in the tree of results, and if it's shared by the tests, it can appear multiple times in the tree. At the point that the fixture runs, the test runner doesn't know what test is about to run, so marks all fixture nodes in the tree as running, although it's only the shared fixture itself that's running. It will then run the actual test, and only the tests that run are marked as running.

这篇关于resharper 测试运行程序 - 如何按类别执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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