#855 TestRunner needs framework assembly in app-domain

2.5
closed-fixed
5
2009-08-06
2009-08-02
No

Hello,
if i run a test and the nunit framework assembly wasn't already loaded into the application domain (which can be the case if i have a addin that detects tests without the framework), i get the exception added at the end of this bug report. This is only a minor issue since the simple workaround is to instantiate a object of a class included in the framework assembly before the test are run. But why should this be done?
Please let me know if you need more information to reproduce/solve this issue.
Best regards,
Andreas Ländle

System.ApplicationException wurde nicht behandelt.
Message="Exception in TestRunnerThread"
Source="nunit.core"
StackTrace:
bei NUnit.Core.TestRunnerThread.TestRunnerThreadProc()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

InnerException
bei NUnit.Core.NUnitFramework.Assert.get_AssertType()
bei NUnit.Core.NUnitFramework.Assert.get_CounterProperty()
bei NUnit.Core.NUnitFramework.Assert.GetAssertCount()
bei NUnit.Core.NUnitTestFixture.DoOneTimeSetUp(TestResult suiteResult)
bei NUnit.Core.TestSuite.Run(TestResult suiteResult, EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
bei NUnit.Core.TestFixture.Run(EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.Run(TestResult suiteResult, EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.RunAllTests(TestResult suiteResult, EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.Run(TestResult suiteResult, EventListener listener, ITestFilter filter)
bei NUnit.Core.TestSuite.Run(EventListener listener, ITestFilter filter)
bei NUnit.Core.SimpleTestRunner.Run(EventListener listener, ITestFilter filter)
bei NUnit.Core.TestRunnerThread.TestRunnerThreadProc()

Discussion

  • Charlie Poole

    Charlie Poole - 2009-08-02

    It looks as if you inherited from NUnitTestFixture, which assumes you're using the NUnit framework. Can you inherit from TestFixture instead? This will eliminate
    the assumption and - I believe - solve the problem for you.

    However, this is still a good bug, since failure to find the Assert Type really
    should be handled in the code.

     
  • Andreas Ländle

    Andreas Ländle - 2009-08-03

    Hi. You are absolutly right - i was using NUnitTestFixture (i've added instances of it to my testsuite). After i switched to TestFixture the problem was gone - but i'm quite unsure if this is what i want. I used the NUnitTestFixture for 'normal' tests (not marked with [Test]). I want that these tests to behave like normal NUnit-Test, so if there is a [SetUp] or [TearDown] i want that code to execute - but with the simple example i startet with i didn't have such attributes and so i didn't had the framework assembly in my application domain...

     
  • Charlie Poole

    Charlie Poole - 2009-08-03

    Just make a copy of the NUnitTestFixture source and add it to your project. Change the name and remove the override of Run. :-)

     
  • Charlie Poole

    Charlie Poole - 2009-08-06
    • assigned_to: nobody --> charliepoole
    • status: open --> closed-fixed
     
  • Charlie Poole

    Charlie Poole - 2009-08-06

    Fixed in source for 2.5.2 release.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks