CodedUi测试App.Config问题:加载错误的文件 [英] CodedUi Tests App.Config Problems: loading wrong files

查看:146
本文介绍了CodedUi测试App.Config问题:加载错误的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了一个远程测试设置(1个控制器,一些代理,1个视觉工作室)。

I used a setup for remote tests ( 1 controller, some agents, 1 visual studio).

直到现在我有一个App.config文件与csproject文件位于同一目录级别。

Till now I have one App.config file located on the same directory level with the csproject file.

我将它添加到测试设置中的已部署文件中。

I added it to the deployed files in the test settings.

 

我通过以下方式访问了应用配置:

I accessed the app config via:

ConfigurationManager .AppSettings [ " key" ];

这工作了一段时间。

 

现在我想要使用不同的App.config文件进行不同的测试设置进行部署。

Now I want to have different testsettings with different App.config files to deploy.

我为每个App.config文件创建了一个子文件夹,并将它们添加到不同的testsettings。

I created a subfolder for each App.config file and added them to the different testsettings.

 

现在,当我尝试使用不同的测试设置运行测试时。

Now when I tried to run the test runs with the different test settings.

但他们仍在阅读旧App.config中的信息。

But they are still reading the info from the old App.config.

这有什么问题?我怎样才能找到解决办法?

Where is the problem with this? How can I find a fix for that?

推荐答案

Hello Live,

感谢您在MSDN论坛上发帖。

根据您的描述,我在不同的文件夹中创建了两个不同的App.config文件与csproject文件位于同一目录级别。我还有两个testsettings文件。我将它们部署到不同的测试设置中。然后我运行测试
,测试可以运行部署相应的App.config。

所以我想知道你是否选择了正确的Active使用不同的测试设置运行时的测试设置。请检查它。

此外,您可以尝试禁用旧的测试设置并使用新的测试设置(包括新的App.config)运行以检查是否有新的App .config可以成功部署和读取。

一篇有用的文章,参见
a单元测试项目可以加载目标应用程序的app.config文件吗?

A useful article, see Can a unit test project load the target applicaion’s app.config file?

Nilesh撰写的关于Uint测试应用程序配置设置的完美博客,请参阅

http://nileshgule.blogspot.com/2010/09/unit-test-application-conf iguration.html

我希望它能为您提供帮助。

致以最诚挚的问候,


这篇关于CodedUi测试App.Config问题:加载错误的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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