I have written a NUnit tests for a .NET application. When I run the NUnit, it does not read the connection string values from the configuration file. I tried many solutions with out success, like
- Adding <assembly name>.dll.config file in the path where NUnit loads the DLL file.
- Adding the configuration settings in NUnit.exe.config/NUnit.gui.config
I wasn’t able to read the configuration setting even when run in VSNunit. Is there a solution?
I’ve assumed
SomeNameSpace.MyClassLibSomeNameSpace.MyClassLib.TestTry this:
Make sure that you have also copied your
app.configto your NUnit Test DLL class library (i.e. projectSomeNameSpace.MyClassLib.Test) as well.Build your NUnit Project (e.g. to
SomeNameSpace.MyClassLib/bin/debug) and make sure that following are in the bin\debug (or release) directorySomeNameSpace.MyClassLib.Test.config)Edit your NUnit Project in the XML view of the NUnit GUI Project editor (menu Project → Edit, or just edit it in Notepad), and make sure that the test assembly (MyClassLib.Test.dll) and the configuration file names are relative to your appbase
For example,