I am using the app.config file in my test project to configure my tests. The control contains the app.config file used by TeamCity to run tests.
When compiled, app.config is copied to the bin folder and renamed to [assembly_name] .config. You can then access any settings in the .config file from the test code using the ConfigurationManager .
On development systems, the .config file is configured to run tests against what has ever been used by the local test server that the developer uses.
I consider this the cleanest approach because it logs how the tests are configured in source control.
If you need more flexibility, you can configure an additional build step in TeamCity to modify the .config file as needed, using some XML conversions or string replacements from a custom MSBuild script.
source share