Reputation: 715
So here is the error that is plaguing my test suite.
[07:34:36][Step 4/4] Exception has been thrown by the target of an invocation.
[07:34:36][Step 4/4]
[07:34:36][Step 4/4] Server stack trace:
[07:34:36][Step 4/4] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
[07:34:36][Step 4/4] at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[07:34:36][Step 4/4] at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
[07:34:36][Step 4/4] at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
[07:34:36][Step 4/4] at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
[07:34:36][Step 4/4] at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
[07:34:36][Step 4/4] at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[07:34:36][Step 4/4] at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[07:34:36][Step 4/4] at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[07:34:36][Step 4/4] at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Run(ITestEventListener listener, String filter)
[07:34:36][Step 4/4] at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
[07:34:36][Step 4/4] at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
[07:34:36][Step 4/4] at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
[07:34:36][Step 4/4]
[07:34:36][Step 4/4] Exception rethrown at [0]:
[07:34:36][Step 4/4] at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[07:34:36][Step 4/4] at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[07:34:36][Step 4/4] at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
[07:34:36][Step 4/4] at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
[07:34:36][Step 4/4]
[07:34:36][Step 4/4] Test Run Summary
[07:34:36][Step 4/4] Overall result: Failed
[07:34:36][Step 4/4] Test Count: 0, Passed: 0, Failed: 0, Inconclusive: 0, Skipped: 0
[07:34:36][Step 4/4] Start time: 2016-05-19 14:15:21Z
[07:34:36][Step 4/4] End time: 2016-05-19 14:34:35Z
[07:34:36][Step 4/4] Duration: 1154.123 seconds
So what I have learned about this error.
I am only getting this exception when running test suite in NUnit.ConsoleRunner.3.2.1. I do not get this error when running tests in VS.
I am getting this error only when I run both of my test suites together in the same build. And I am only getting this exception when I run the whole thing. I have done many runs taking some tests out and putting them in running just one suite, and then running the other. Apart things all work but all together they have this issue.
It also seems that this is not triggered by any event in my test code. I have added logging to the start and end of each test case and to the OneTimeTearDown
and after a run I can see the in the logs that all test cases completed and all tear downs finished. It seems that this issue happens when NUnit is generating the test results/report. Any information about this exception would be great. I guess worst case I split my test suites into different branches and run them independently but I would much rather have them all ran with one job instead of multiple.
Upvotes: 2
Views: 600
Reputation: 715
So I ended up opening a bug report with the NUnit developers. https://github.com/nunit/nunit/issues/1509
What worked for me was to execute my tests with the flag --inprocess
that resolved this issue for the time being. They just marked this bug as "closed" with the release of NUnit ConsoleRunner 3.4.1. I have since removed --inprocess
and not seen the issue arise although let me qualify that with the face that currently my test suites are only running against Firefox as there is a different issue with Chrome v 51 running in session[0] which is how the TeamCity server I run them on initiates chrome.
Hope this helps
Upvotes: 1