To verify that this is the problem, first use NUnit's own tests. You
should be able to select and run a subset with no problem.
If that works, use something like a binary search to find the problem.
Turn on checkboxes in the Gui. Select the first test you know of that
fails when run alone. See it fail. Now select in addition half of the
previously unselected tests above it. If it passes, the failing test
depends on one of those you just selected. If it still fails, then the
culprit is one of the tests you did not select. Proceed till you find
the test which causes the problem.
Warning: This will only work if the problem is one simple dependency.
Charlie
> --
> You received this message because you are subscribed to the Google Groups "NUnit-Discuss" group.
> To post to this group, send email to nunit-...@googlegroups.com.
> To unsubscribe from this group, send email to nunit-discus...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nunit-discuss?hl=en.
>
From the error below, it's clear that NUnit itself - rather than your
tests - is trying to load the dll in question. This usually happens
when a custom exception, defined in one of your assemblies, is
uncaught in the tests. Is that a possibility in this scenario?
If this is the case, then NUnit would be failing in deserializing the
exceptioni because it can't load the assembly in which the exception
is defined. One way to find out is to temporarily copy the "missing"
assembly to the directory containing nunit-agent.exe, along with any
dependencies that may be needed.
This issue with custom exceptions may or may not be your problem, but
it's a long-standing issue and I suggest looking at it next.
BTW, in NUnit 3.0, the plan is to prevent any exceptions from
travelling across the remoting boundary by catching them and
transforming them into an xml error report.
Charlie
Have you turned on NUnit's internal trace and looked at whether it
tells you anything?
Charlie
Regarding loading: NUnit does not reload any tests unless you tell it to.
You should probably turn off any automatic reload settings if you have
them set. That way you can manually control when a reload takes place.
Charlie
On Mon, Apr 2, 2012 at 6:04 AM, nickdu <nic...@msn.com> wrote:
> There were trace files created with trace information in them, just
> none of it seemed to point to a reason for the issue I'm having.
Right - that's what I meant. NUnit is simply considering your
problem as a test failure, not an NUnit problem worthy of logging.
> I don't have any automatic reload setting turned on.
OK
> When I mentioned loading it was more about how NUnit loads a class and/
> or method in order to execute it. It seems odd that if I select the
> Lock class and run I get different behavior than when I choose each
> Lock test method individually and run them. My guess is that NUnit is
> loading the code differently in those two cases.
NUnit's "Loading" involves only your test assembly. It has to happen before
the tests can be displayed in the Gui. That loading is only repeated if you
use a reload item on the menu or if you have enabled automatic reload on
run or when the assembly changes.
Loading of dependent assemblies happens according to normal .NET rules,
as the code is jitted and executed. Again, once a dependent assembly is
loaded into the test AppDomain, it stays there.
So, your problem arises when the dependent assembly is first needed by
one of the Lock tests. If you have run some other test first, which successfully
loads the assembly, then the Lock tests have no problem. This is exactly
the sort of inter-test dependency I was originally writing about - not
necessarily
a dependency that you intentionally created, but one that exists nevertheless.
I guess that gives you two possible attacks on the problem:
1. Trace how and why the Lock class cannot load the assembly.
2. Trace how and why the complete class is able to load the assembly.
What's different in these classes?
Charlie
PS: Feel free to post some code if it doesn't expose any company secrets.
Regarding dependencies, I'd say that if running tests 1-4 has an
effect on test 5, that's a dependency by definition. It's just one that
we don't yet understand and which is probably due to the underlying
platform - or NUnit itself - rather than something you coded explicitly.
Charlie
Sounds like you may have found an obscure NUnit bug.
Nunit actually has code that's supposed to prevent this from happening
and even some tests to make sure it doesn't happen. But it could be
that we have missed some particular situation.
All the calls back to the gui or console runner go through an event queue,
which is written by the test thread and read by a thread that is used
only to return events to the NUnit AppDomain. So, in theory, this should
prevent any part of the thread context from flowing back to the NUnit
application.
The only place where I know this can be violated is if an exception
is thrown, but maybe there are others.
If you have time and are able to create a simple repro of this problem,
I hope you'll submit a bug.
Charlie