How to use “external” configuration files e.g. SharedApp.config with a test project?

Error:
Test method TestProjectBusiness.dsBusinessHelperTest.FillAdviceNoteTest threw exception:
System.Configuration.ConfigurationErrorsException: Unable to open configSource file ‘SharedApp.config’. (…Visual Studio 2010\Projects\…\TestResults\…\Out\TestProject.DLL.config line 8)

Solution at:
http://stackoverflow.com/questions/152866/how-can-you-use-external-configuration-files-i-e-with-configsource-with-an-m

Quote
“If you edit the test run configuration (by double clicking the .testrunconfig file that gets put into the ‘Solution Items’ solution folder when you add a new unit test), you get a test run configuration dialog. There’s a section there called ‘Deployment’ where you can specifiy files or whole folders from anywhere in the solution that can be copied out with the compiled assemblies at run time to the correct folder.

In this way, I can now actually just define most of my configuration in one set of external .config files and have them automatically copied out at the run of each test.”

My Notes:
This works. You may have to close and re-open the test run – test list editor .vsmdi for the appropriate test-settings to take affect.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: