Reputation: 25701
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>
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?
Upvotes: 3
Views: 1051
Reputation: 15217
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.
Upvotes: 3