Hi,
I am having a
problem using nunit2 under nant. I'm testing NUnitTests.dll and my config file
is NUnitTests.dll.config . However, when I build using nant the the test dll is
unable to find an appsetting that exists in NUnitTests.dll.config .Shouldn't the
configuration info reside here when testing a dll?
Before all the
lengthy doc I will point out that I have Microsoft Application Blocks installed
which use some config sections in the main config file and then use various
element values as names of further xml files that it then accesses. From the
event log I can see that the initial problem that set this off was an appsetting
value that was not retried and this led to an exception, that I would expect
when appsetting was not present (but it is present and I can only assume that my
dll under test is not accessing the right config file). The next thing that
happens is that in the course of processing the exception (due to missing
appsetting...that is detailed in event log) the MS app blocks configuration is
loaded and probably due to the same .config confusion it incurs exceptions...the
ones seen in the nunit test results below.
I am clueless as to
the sort of hocus-pocus that is required to have the dllname.dll.config file be
the one that will be accessed by the dll and all its dependencies instead
of the usual exename.exe.config. I could dive into nant debugging but I ahve to
choose the "black holes for my time" judiciously these days.
Hopefully, this is a
non-brainer for someone deep into nant internals or someone else will recognize
the symptom and know the resolution.
THANKS!!!!! if
anyone can help!
Sincerely,
Pat
Pattillo
Here is the nunit2
section in my nant build script:
<!--
Run NUnit test and generate XML output -->
<target name="runUnitTests" description="Run NUnit test and generate XML
output">
<nunit2 failonerror="false" haltonerror="false" verbose="true">
<formatter outputdir="${Build.OutputFolder}Latest\"
usefile="true" type="Xml" extension=".xml"/>
<test appconfig="NUnitTests.dll.config">
<assemblies basedir="${Build.OutputFolder}Latest\">
<includes name="*Tests.dll"/>
</assemblies>
</test>
</nunit2>
</target>
AND...Here are test results. nant actually gets exceptions (displayed in command window, though most results are in xml file). First the command window output:
[nunit2] Tests
Failed:
NAnt.Core.BuildException: Tests Failed
at
NAnt.NUnit2.Tasks.NUnit2Task.ExecuteTask() in
C:\DOCUME~1\ADMINI~1\LOCALS~
1\Temp\tmp26.tmp\src\NAnt.NUnit\NUnit2\NUnit2Task.cs:line
266
at NAnt.Core.Task.Execute() in
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\tmp26.tmp\s
rc\NAnt.Core\Task.cs:line
143
HERE...are the results from the xml file:
<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<!--
This file represents the results of running a test suite-->
- <test-results name="NUnitTests.dll" total="1" failures="1" not-run="0" date="2/16/2005" time="7:43 PM">
<![CDATA[
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException : Invalid section name. The section 'exceptionHandlingConfiguration' does not exist in the requested configuration file 'C:\SourceSafe\C3P\NUnitTests.dll.config' or the file 'c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'exceptionHandlingConfiguration' is defined. ----> System.Configuration.ConfigurationException : Invalid section name. The section 'exceptionHandlingConfiguration' does not exist in the requested configuration file 'C:\SourceSafe\C3P\NUnitTests.dll.config' or the file 'c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'exceptionHandlingConfiguration' is defined.]]>
</message>
<![CDATA[
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName, ConfigurationContext configurationContext) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionPolicy.cs:line 169 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception ex, String policyName, ConfigurationContext configurationContext) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionPolicy.cs:line 105 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception ex, String policyName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionPolicy.cs:line 67 at IBD.DataAccess.OutputParameters.Query() in c:\SourceSafe\C3P\IBD.DataAccess\Bases.cs:line 422 at IBD.DataAccess.GET_DATES.Query() in c:\SourceSafe\C3P\IBD.DataAccess\ParameterizedQueries.cs:line 171 at NUnitTests.Tests.ZipCode() in c:\SourceSafe\C3P\NUnitTests\Class1.cs:line 31 --ExceptionHandlingException at Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationBuilder.ValidateSection(String sectionName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\Configuration\ConfigurationBuilder.cs:line 598 at Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationBuilder.ReadConfiguration(String sectionName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\Configuration\ConfigurationBuilder.cs:line 201 at Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationContext.GetConfiguration(String sectionName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\Configuration\ConfigurationContext.cs:line 128 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingConfigurationView.GetExceptionHandlingSettings() in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionHandlingConfigurationView.cs:line 45 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingConfigurationView.GetExceptionPolicyData(String policyName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionHandlingConfigurationView.cs:line 61 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyFactory.GetConfigurationType(String policyName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionPolicyFactory.cs:line 59 at Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationFactory.CreateInstance(String configurationName) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\Configuration\ConfigurationFactory.cs:line 113 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyFactory.CreateExceptionPolicy(String policyName, Exception exception) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionPolicyFactory.cs:line 53 at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName, ConfigurationContext configurationContext) in c:\SourceSafe\Microsoft Enterprise Library\EnterpriseLibrary.root\EnterpriseLibrary\ExceptionHandling\ExceptionPolicy.cs:line 163]]>
</stack-trace>
</failure>
</test-case>
</results>
</test-suite>
</results>
</test-suite>
</results>
</test-suite>
</test-results>
