Inner exceptions in the Test Runner
Hi,
I have noticed that the Test Runner does not display all the exception information. Here is the output from an example failure as shown by the Unit Test Runner:
Rhino.Mocks.Exceptions.ExpectationViolationException: IProperties.set_Selection(Region, Start = 15, Length = 30); Expected #1, Actual #0.
at Rhino.Mocks.Impl.ReplayMockState.Verify()
at Rhino.Mocks.MockRepository.Verify(Object obj)
at Rhino.Mocks.MockRepository.VerifyAll()
at BSP.HexEditor.Tests.DocumentTextAdapterInteractionTest.LeftMouseClickSetsSelection() in DocumentTextAdapterInteractionTest.cs:line 260
And here is it as shown in the Output window by the TestDriven.NET plugin:
TestCase 'BSP.HexEditor.Tests.DocumentTextAdapterInteractionTest.LeftMouseClickSetsSelection'
failed: Rhino.Mocks.Exceptions.ExpectationViolationException : IProperties.set_Selection(Region, Start = 15, Length = 30); Expected #1, Actual #0.
TearDown : System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
-
> Rhino.Mocks.Exceptions.ExpectationViolationException : Unordered method call! The expected call is: 'Ordered: { IProperties.get_Selection(); }' but was: 'IProperties.set_Selection(Region, Start = 15, Length = 34);'
at Rhino.Mocks.Impl.ReplayMockState.Verify()
at Rhino.Mocks.MockRepository.Verify(Object obj)
at Rhino.Mocks.MockRepository.VerifyAll()
F:\Programming\Current\Hex Editor\Hex Editor Tests\Adapters\DocumentTextAdapterInteractionTest.cs(260,0): at BSP.HexEditor.Tests.DocumentTextAdapterInteractionTest.LeftMouseClickSetsSelection()
--TearDown
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at NUnit.Core.TestMethod.doTearDown(TestCaseResult testResult)
--TargetInvocationException
F:\Programming\Current\Hex Editor\Test Utilities\GUIUnitTest.cs(72,0): at BSP.TestUtilities.GUIUnitTest.TearDown()
As you can see, it looks like inner exceptions are not being displayed in the Test Runner: is there any way to enable this? If not, is this feature planned for a future release?
Thanks in advance,
Max
Please sign in to leave a comment.
ReSharper' UnitTestRunner shows the inner exception of it is available. In your case it is likely that someone intercepts the exception and rethrowns its own
Looking at the stack trace more carefully, it looks like the actual problem is that an exception is being thrown in TearDown but not reported in the Test Runner. I have submitted a JIRA issue for this: http://www.jetbrains.net/jira/browse/RSRP-29441