Separate appDomains when running tests from nunit console

Bug #487482 reported by shaizaban
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit V2
Fix Released
High
Charlie Poole
Declined for 2.5 by Charlie Poole
Declined for Trunk by Charlie Poole

Bug Description

running my tests in v-2.5.2 (by nunit console), I encountered a problem of appDomains unwanted separation. my test dll is running under a dedicated appDomain, whereas the nunit console exe is running under the default appDomain. this separation caused some of my tests to fail. in v-2.4.8, by writting in the command line: "Domain=None", i avoided this separation, so all tests and executables ran under one appDomain, which is the default one.

looking into the source code of v-2.5.2 and v-2.4.8, i noticed that the case of DomainUsage.None case was forgotten in the TestRunnerFactory class.
in v-2.4.8, a RemoteTestRunner was created in this case. in v-2.5.2, no specific handling was done, so a TestDomain was created, which creates a dedicated appDomain.

the relevant source code, with my change, is (in TestRunnerFactory.cs, MakeTestRunner method):

            switch (processModel)
            {
                case ProcessModel.Multiple:
                    package.Settings.Remove("ProcessModel");
                    return new MultipleTestProcessRunner();
                case ProcessModel.Separate:
                    package.Settings.Remove("ProcessModel");
                    return new ProcessRunner();
                default:
                    DomainUsage domainUsage =
                        (DomainUsage)package.GetSetting("DomainUsage", DomainUsage.Default);
                    if (domainUsage == DomainUsage.Multiple)
                    {
                        package.Settings.Remove("DomainUsage");
                        return new MultipleTestDomainRunner();
                    }
                    // my added code
                    else if (domainUsage == DomainUsage.None)
                    {
                        return new RemoteTestRunner();
                    }
                    // end - my added code
                    else
                    {
                        return new TestDomain();
                    }
            }

i submitted a post on this issue and got from Charlie the following answer:

"Hi Shai,

This is based only on code review - I have not yet written
a test - but it looks like this feature may have been dropped
unintentionally during the 2.5 beta period.

In the past, nunit-console.exe and nunit.exe had separate
code to determine what sort of test runner to create. When
the console runner was converted to use the same factory
that is used by the gui, the DomainUsage.None capability
should have been added to the factory but was not.

Would you please file a bug on this?

Charlie"

Related branches

Changed in nunitv2:
assignee: nobody → Charlie Poole (charlie.poole)
importance: Undecided → High
milestone: none → 2.5.3
status: New → Triaged
Changed in nunitv2:
status: Triaged → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.