Hi all,
I searched the WWW, and this group in particular, but couldn't find
any info
directly related to my problem. Our setup is CC.NET, Nant + MbUnit
and I only
see this problem on the build server where Nant is running the tests.
Devs run
the tests from within their studio. At the highest level the problem
manifests
with this error from CC.NET:
Unexpected engine error while running Tests
Failed loading assemblies
Item has already been added. Key in dictionary: 'IDADataLayerTests'
Key being added: 'IDADataLayerTests'
So that narrows it down to a problem when loading all of my test
assemblies at
once, ie, using a Nant task like:
<target name="unittests" description="Execute unit tests for IDA
projects.">
<mbunit report-types="xml" report-filename-format="latest-mbunit-
report"
report-output-directory="d:\autobuild\IDAv2">
<assemblies>
<include name="${working.dir}/**/bin/debug/*Tests.dll"/>
<!--since the data layer test library is referenced from others
it
will
get tested so exclude it to avoid errors with Nant.-->
<exclude name="${working.dir}/**/IDADataLayerTests/**"/>
</assemblies>
</mbunit>
</target>
The reason the error happens is that I factored out some common test
code to
a single assembly and then reference it from other test assemblies, so
that
assembly gets loaded more than once. Notice the exclude element in
the above
target. It solves the problem until I need to reference my common
test code
from more than one other assembly.
This excerpt from the Nant build log shows the common assembly
(IDADataLayerTests)
in the list several times. Once 'directly' for executing the tests it
contains,
then two more times because it is referenced by IDAProviderTests and
IDABusinessLayerTests. Also, following that it shows the stack trace
from the
exception.
unittests:
[mbunit] MbUnit 1.0.2531.41788 test runner
[mbunit] Loading 7 assemblies
[mbunit] AssemblyName: d:\cc.net.working.v2\IDA\Projects\IDA
\IDABusinessLayerTests\bin\Debug\IDABusinessLayerTests.dll
[mbunit] AssemblyName: d:\cc.net.working.v2\IDA\Projects\IDA
\IDABusinessLayerTests\bin\Debug\IDADataLayerTests.dll
[mbunit] AssemblyName: d:\cc.net.working.v2\IDA\Projects\IDA
\IDAProviders\bin\Debug\IDADataLayerTests.dll
[mbunit] AssemblyName: d:\cc.net.working.v2\IDA\Projects\IDA
\IDAProviderTests\bin\Debug\IDADataLayerTests.dll
[mbunit] AssemblyName: d:\cc.net.working.v2\IDA\Projects\IDA
\IDAProviderTests\bin\Debug\IDAProviderTests.dll
[mbunit] AssemblyName: d:\cc.net.working.v2\JSDTools\Projects\JSDTools
\JSDCommonTests\bin\Debug\JSDCommonTests.dll
[mbunit] AssemblyName: d:\cc.net.working.v2\JSDTools\Projects\JSDTools
\JSDSecureTests\bin\Debug\JSDSecureTests.dll
Build Error: NAnt.Core.BuildException
Unexpected engine error while running Tests
at MbUnit.Tasks.MbUnitTask.ExecuteTests(FileSet assemblySet)
at MbUnit.Tasks.MbUnitTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean
forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
I dug into this a bit and found that this code hasn't really changed
much recently
so I'm assuming that nobody else has run into this problem, rather
than it being a new issue.
Also, without the inner exception being displayed by Nant, and from
looking at the source, if I
had to guess I'd point at TestDomainDependencyGraph or its member
AdjacencyGraph (which I couldn't find).
I'm looking for ideas on how I might repro this on a dev machine to
pinpoint the source of the error, since it only happens when all of
the assemblies are loaded at once and I don't know how to make
MbUnit do that from within the debugger.
One more thing: I did rework our assembly layout so that the common
test code
is in the JSDCommonTests assembly, and then tested again, but came up
with the
same exception, only with 'JSDCommonTests' as the duplicate key, as
expected.
Thanks in advance,
Danny
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---