nunit: Test with multiple parameterized TestFixture throws exception upon completion

I’m working on upgrading my tests from 2.6.3 to 3.2.1. I have a (fairly elaborate) suite which has four parameterized TestFixture attributes (the arguments have been sanitized):

    [TestFixture("aaaaa", "")]
    [TestFixture("bbbbb", "")]
    [TestFixture("ccccc", "ddddd")]
    [TestFixture("eeeee", "")]
    [Category("ActivationTests")]
    class ConsumerActivationTest : TakesScreenshotOnTestFailure
    {
      ...

The call to NUnit is:

C:\Program Files (x86)\NUnit-3.2.1\bin\nunit3-console.exe Test.dll --where cat==ActivationTests --work=C:\App\NUnit3Test\NUnit3.Activation.Consumer

The following call also fails in the same manner:

C:\Program Files (x86)\NUnit-3.2.1\bin\nunit3-console.exe Test.dll --where class=~FunctionalTests.ActivationTests.Consumer.* --work=C:\App\NUnit3Test\NUnit3.Activation.Consumer

All four test suites run to completion, but TestResult.xml only contains the following (I’ve edited the paths to remove company info):

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<test-run id="2" testcasecount="1" result="Failed" label="Error" total="1" passed="0" failed="1" inconclusive="0" skipped="0" asserts="0" engine-version="3.2.1.0" clr-version="4.0.30319.34209" start-time="2016-05-05 16:53:28Z" end-time="2016-05-05 17:06:06Z" duration="757.806002">
  <command-line><![CDATA["C:\Program Files (x86)\NUnit-3.2.1\bin\nunit3-console.exe"  App.Test.dll --where class=~FunctionalTests.ActivationTests.Consumer.* --work=C:\App\NUnit3Test\NUnit3.Activation.Consumer]]></command-line>
  <filter>
    <class re="1">FunctionalTests.ActivationTests.Consumer.*</class>
  </filter>
  <test-suite type="Assembly" id="0" name="" fullname="" runstate="NotRunnable" testcasecount="1" result="Failed" label="Error" start-time="2016-05-05 17:06:06Z" end-time="2016-05-05 17:06:06Z" duration="0.001" total="1" passed="0" failed="1" inconclusive="0" skipped="0" asserts="0">
    <failure>
      <message><![CDATA[Exception has been thrown by the target of an invocation.]]></message>
      <stack-trace><![CDATA[
Server stack trace: 
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
   at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   at NUnit.Engine.Drivers.NUnit3FrameworkDriver.CreateObject(String typeName, Object[] args)
   at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Run(ITestEventListener listener, String filter)
   at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
   at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)]]></stack-trace>
    </failure>
  </test-suite>
</test-run>

If I comment out three of the four parameterized TestFixtures, everything completes - testResults.xml has the test data output.

Please let me know if there’s any more info I can provide. Thanks.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

@alexSimy Great, but that was meant more for diagnosis, than as a actual solution. 😃

It tells us that the problem is in the actual remoting, and it’s not an underlying exception that is being masked. There was a related bug fix that went in recently - try updating to v3.4 when it is released, and see if that solves the problem. (Should be around the end of this week, I believe.)