Friday, July 01, 2005

NUnit and Config Files

I'm writing NUnit tests using System.Configuration.ConfigurationSettings.AppSettings to read in database connection strings. NUnit needs a configuration file, but the documentation's confusing on where it needs to go. Thankfully, Ross Pressner posted a clearly written description to microsoft.public.dotnet.general back in September, 2004. If you're testing using a dll holding your tests, then your config file needs to be co-located with that dll. If your tests are located in an NUnit project file, then your config file needs to be co-located with that file. For example, tests in the assembly D:\projects\MyApp\DataLayerTests\bin\DataLayersTests.dll needs a config file like so: D:\projects\MyApp\DataLayerTests\bin\DataLayersTests.dll.config Tests in the NUnit project file D:\projects\MyApp\MyTests.nunit need a config file like so: D:\projects\MyApp\MyTests.config Be sure to carefully note the naming variants.

1 comment:

Anonymous said...

Thanks for the post. Just wanted to let you know that it helped me greatly.

Subscribe (RSS)

The Leadership Journey