获取TeamCity的阅读我N​​Unit测试配置文件配置文件、测试、TeamCity、Unit

由网友(結尾无我)分享简介:我使用NUnit和C#来测试我的应用程序在VS 2010中的一个项目。我的项目被称为MyProjectTests并按照NUnit的,我有,有一个连接字符串中有一个MyProjectTests.config文件,我的测试数据库中,像这样:I have a project in VS 2010 using NUnit a...

我使用NUnit和C#来测试我的应用程序在VS 2010中的一个项目。我的项目被称为MyProjectTests并按照NUnit的,我有,有一个连接字符串中有一个MyProjectTests.config文件,我的测试数据库中,像这样:

I have a project in VS 2010 using NUnit and C# to test my application. My project is called MyProjectTests and as per NUnit, I have a MyProjectTests.config file that has a connection string in it to my test database, like so:

<?xml version="1.0"?>
<configuration>
<appSettings>

    <add key="defaultConnection" value="MyConnection"/>
</appSettings>
<connectionStrings>
    <add name="MyConnection" connectionString="My_Connection_String_Details" providerName="System.Data.SqlClient"/>
</connectionStrings>

但是,当我跑我的TeamCity的NUnit的测试中,在连接字符串为空。如何使TeamCiry阅读我的连接文件?别的东西了?

But when I run my TeamCity NUnit tests, the connection string is Null. How do I make TeamCiry read my connection file? Is something else wrong?

推荐答案

您应该为您的设置文件的App.config,摆在测试项目的根目录下,并将其纳入。 NUnit的和TeamCity的选手既​​将使用该App.config中设置。

You should name your settings file as App.config, put in the root of test project and include it. NUnit and TeamCity runners both will use settings from that app.config.

阅读全文

相关推荐

最新文章