本文介绍了Visual Studio 2015 订购测试.如何使用 .runsettings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2015 Enterprise(更新 1)中构建有序测试时遇到困难,并且在有序测试中的单元测试能够引用我的 .runsettings.

I am having difficulty building an ordered test in Visual Studio 2015 Enterprise (Update 1) and having the unit tests within the ordered test be able to reference my .runsettings.

具体来说,我需要访问 TestRunParameters"nofollow">.runsettings 文件.

Specifically, I need to access the TestRunParameters defined in the .runsettings file.

在我的任何测试方法中,如果我访问 属性 TestContext,我在 .runsettings 未找到.

In any of my test methods, if I access the Properties of the TestContext, the properties I defined in the .runsettings are not found.

我当然不是第一个这样做的人.任何帮助将不胜感激.

Surely I'm not the first to do this. Any help would be appreciated.

推荐答案

我想我了解 Visual Studio 中的错误.每当您在 VS->Test->Test Settings 子菜单中选择 runsettings 文件时,它们不会生效,直到我至少重新构建我的测试项目(或清洁解决方案/构建解决方案).简单地构建不会使 VS 应用正确的运行设置文件.在某些情况下,它没有应用任何 runsettings 文件,但是由于我每次选择不同的 runsettings 文件时都开始进行重建项目,因此我从未发现 TestContext 没有具有我的 Proerties.

I think I understand the bug in Visual Studio. Whenever you select a runsettings file in the VS->Test->Test Settings submenu, they do NOT take effect until I at least do a Rebuild of my Test project (or a Clean solution / Build solution). Simply building does NOT make VS apply the proper runsettings file. There were certain situations where it wasn't applying any runsettings file, but since I started doing a Rebuild Project every time I select a different runsettings file, I've never discovered the TestContext not having my Proerties.

这篇关于Visual Studio 2015 订购测试.如何使用 .runsettings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!