无法在VS 2017中运行有序测试 [英] Can't run ordered tests in VS 2017

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

问题描述

这令人费解 - 我添加了一个新的"有序测试"。设置为解决方案中的单元测试项目。我在各种
MSDN文章中了解了有序测试。但是在将选定的测试添加到这个新的有序测试集之后,我看不到如何运行测试!

This is puzzling - I added a new "ordered test" set to a unit test project in a solution. I read about the ordered tests in various MSDN articles. But after adding selected tests to this new ordered test set, I cannot see how to run the tests!

如果我在解决方案资源管理器中右键单击项目中新订购的测试项,上下文菜单没有运行,调试或任何选项。

If I right-click the new ordered test item in the project in solution explorer, the context menu has no option to run, debug or anything.

如果我看一下Test Explorer窗口,我只能看到各种测试类及其包含的测试,没有新的跟踪有序测试。

If I look at the Test Explorer window all I can see are the various test classes and their contained tests, no trace of the new ordered test.

这个新订购的测试项目是否应出现在测试资源管理器中?我必须做某事以某种方式将其添加到测试资源管理器中吗?

Should this new ordered test item appear in Test Explorer? must I do something to somehow add it to test explorer? 

更新

确定我关闭并重新打开解决方案并且订购的测试出现在测试资源管理器(好像它是另一类测试方法)。

OK I closed and reopened the solution and the ordered test appeared in Test Explorer (as if it were another class of test methods).

然而,奇怪的是它似乎没有分解为有序测试中定义的各个测试。

However, oddly it does not seem to breakdown into the individual tests defined in the ordered tests.

我的测试类显示为节点,在展开时显示所有包含的测试方法。但是,尽管包含多个测试方法的有序测试没有这样的细分 - 只显示为orderedtest1(即使名称的情况与项目中OrderedTest1.orderedtest文件的
情况不匹配!

My test classes appear as nodes which when expanded reveal all of their contained test methods. But the ordered test despite containing multiple test methods has no such breakdown - just appears as orderedtest1 (even the case of the name does not match the case of the OrderedTest1.orderedtest file in the project!

当我运行它时,它会运行所有包含的测试。

When I run it it runs all the contained tests however.

最后当测试失败时,在有序测试中,我会查看测试资源管理器底部窗格中的详细信息,如果我点击有序测试的名称(命名为"Source"),那么它将继续启动Visual Studio 2012!

Finally when a test fails that's in the ordered test and I look at the details in the Test Explorer bottom pane, if I click on the name of the ordered test (named as "Source") then it proceeds to launch Visual studio 2012 !

坦率地说,这看起来非常错误。

Frankly this looks pretty buggy to me.

谢谢

Hugh

推荐答案

<你好Hugh,

感谢你的帖子。

>>然而,奇怪的是它似乎没有分解成在有序测试中定义的单个测试。

您在项目中添加订单测试,然后您将您的测试方法添加到订单测试

You add an order test in your project, then you add your test method to the order test:

例如:

如果一个测试方法失败,您希望测试继续运行,选中复选框
失败后继续

you want the test to keep running if one test method fails, select the checkbox of Continue after failure

订单测试将作为 序列 您添加测试方法运行,  mine   TestMethod1,TestMethod2然后是TestMethod3。

the order test will run as the sequence you add the test method, mine is TestMethod1, TestMethod2 and then TestMethod3.

因为我没有在失败后选择继续,所以我的ordertest将在TestMethod2之后停止:

as I did not select Continue after failure, so my ordertest will stop after TestMethod2:

每次 我们编辑 OrderTest.ordertest  我们需要重建项目。

every time we edit the OrderTest.ordertest we need rebuild the project.

>> 最后当测试失败时,在有序测试中,我查看测试资源管理器底部窗格中的详细信息,如果我点击有序测试的名称(命名为"Source"),那么它将继续启动Visual 2012年工作室!

这很奇怪。 您可以尝试将VS2017设置为最终的默认VS IDE。

This is weird.  You may try to set VS2017 as the default VS IDE in your end.


  1. 按windows + r打开运行窗口,然后写入"regedit"。打开你的PC注册表。
  2. 然后转到HKEY_LOCAL_MACHINE - >软件 - >微软 - > Windows - > Currentversion - >  
    应用路径 - > devenv.exe
  3. 单击devenv.exe并更改默认值。
  1. Press windows + r to open run window and then write "regedit" to open your PC registry.
  2. Then go to HKEY_LOCAL_MACHINE -> SOFTWARE -> Microsoft -> Windows -> Currentversion ->  App Paths -> devenv.exe
  3. Click on devenv.exe and change the value of default.

您可能会这样:

C:\Program Files(x86)\ Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe

然后你 用你的VS 2017路径替换它。

Then you replace it with your VS 2017 path.

希望它有所帮助。

祝你好运,

Fletch

  

  


这篇关于无法在VS 2017中运行有序测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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