Hi I am having a problem with NUnit and ConfigurationManager
I have several unti tests to test manipulation of a configuration file. in most of my tests I create a file and delete it at the end of the test.
However I have 2 tests where I create the file using new ConfigurationManager(path);
I then attempt to re-open the same file with the same path again using new ConfigurationManager(path);
I create an NUnit project and run it along with a few other nunit tests.
Recently we were forced to fix our platform to x86 (due to 3rd party components)
Prior to this change everything worked fine but now I constantly get an exception during the above mentioned tests and specifically on the line new ConfigurationManager(path);
The exception is IO.FileNotFoundException and refering to one of my application libraries.
Also to confuse me even more, the exception only occurs when I run the test via the project. It does not occur when I run the test using visual studios or when I add the dll directly to the nunit client (drag and drop)
Thanks in advance for any help
K
-EDIT:
I have added the exceptions and the config file xml for reference
Hornbill.UnitTests.Configuration.ConfigurationManagerBasics.TestAppendGetDelete:
System.Configuration.ConfigurationErrorsException : An error occurred
creating the configuration section handler for hornbill.settings:
Could not load file or assembly ‘Hornbill.Application.Core,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its
dependencies. The system cannot find the file specified.
(C:\Users\KieranJS\AppData\Local\TestConfigurationFile1.xml line 4)
—-> System.IO.FileNotFoundException : Could not load file or assembly ‘Hornbill.Application.Core, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null’ or one of its dependencies. The system cannot
find the file specified.
config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="hornbill.settings" type="Hornbill.Configuration.Sources.Entities.SettingsSection, Hornbill.Application.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<hornbill.settings>
<forms>
<form id="Hornbill.LoginModule">
<item id="Test1">
<value>TestValue1</value>
</item>
</form>
</forms>
</hornbill.settings>
</configuration>
So I solved the problem by changing the NUnit setting: Test Loader – Default Process Model to “Run tests in a separate process per Assembly”