Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReSharper 2018.1.2 NUnit TestCaseSource (.NET Core / VS2017)

I have seen all of the following questions:

  • NUnit .NET Core running through Resharper
  • Running NUnit Tests in .NET Core with ReSharper
  • NUnit TestCaseSource

Despite following all of their advice and having the following lines in all of my test projects:

<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />

I am still getting the following errors in the Unit Test Explorer window of ReSharper (version 2018.1.2):

2018.06.23 11:22:21.292   ERROR Transition failed: Transition from state <HandShake> on event <remote::.ProtocolVersion>. Cause: System.InvalidOperationException: Test-cases are missing for the selected tests. Rebuild the project and try again. at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo() at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument) at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)

--- EXCEPTION #1/1 [LoggerException]
Message = “
  Transition failed: Transition from state <HandShake> on event <remote::.ProtocolVersion>.
  Cause: System.InvalidOperationException: Test-cases are missing for the selected tests. Rebuild the project and try again.
     at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo()
     at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument)
     at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)
”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
  at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestProtocol.<.ctor>b__22_14(Object sender, TransitionExceptionEventArgs`2 args)
     at Appccelerate.StateMachine.Machine.StateMachine`2.RaiseEvent[T](EventHandler`1 eventHandler, T arguments, ITransitionContext`2 context, Boolean raiseEventOnException)
     at Appccelerate.StateMachine.Machine.StateMachine`2.OnExceptionThrown(ITransitionContext`2 context, Exception exception)
     at Appccelerate.StateMachine.Machine.Contexts.TransitionContext`2.OnExceptionThrown(Exception exception)
     at Appccelerate.StateMachine.Machine.States.State`2.HandleException(Exception exception, ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.HandleEntryActionException(ITransitionContext`2 context, Exception exception)
     at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryActions(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.Entry(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.EnterShallow(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.EnterHistoryNone(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.EnterByHistory(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.Transitions.Transition`2.Fire(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.States.State`2.Fire(ITransitionContext`2 context)
     at Appccelerate.StateMachine.Machine.StateMachine`2.Fire(TEvent eventId, Object eventArgument)
     at Appccelerate.StateMachine.ActiveStateMachine`2.ProcessEventQueue(CancellationToken cancellationToken)
     at Appccelerate.StateMachine.ActiveStateMachine`2.<Start>b__32_0()
     at System.Threading.Tasks.Task.InnerInvoke()
     at System.Threading.Tasks.Task.Execute()
     at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
     at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
     at System.Threading.Tasks.ThreadPoolTaskScheduler.LongRunningThreadWork(Object obj)
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.ThreadHelper.ThreadStart(Object obj)
”

2018.06.23 11:22:21.315   ERROR System.InvalidOperationException: Test-cases are missing for the selected tests. Rebuild the project and try again.
   at JetBrains.ReSharper.UnitTestFramework.DotNetCore.DotNetVsTest.DotNetVsTestExecution.SendGetProcessStartInfo()
   at Appccelerate.StateMachine.Machine.ActionHolders.ArgumentLessActionHolder.Execute(Object argument)
   at Appccelerate.StateMachine.Machine.States.State`2.ExecuteEntryAction(IActionHolder actionHolder, ITransitionContext`2 context)
2018.06.23 11:22:21.316    WARN Element UnitTests.Tests.RegressionTests was left pending after its run completion.
2018.06.23 11:22:21.316    WARN Element UnitTests.Tests.RegressionTests.TestAllRegressions was left pending after its run completion.

These are the newest versions of each of these packages, but I have also tried matching NUnit's version to the TestAdapter's version (3.10.0). The most baffling part of this is that Visual Studio's Test Explorer has no problem running the tests! I would very much like to use ReSharper's explorer to easily run their profiling and coverage tools on my tests.

Moreover, at some point in time ReSharper's test explorer used to work, but I'm not aware of the particular version combination that led to it. This setup still works for basic [Test] style tests and only fails for [TestCaseSource] tests.

ETA: ReSharper is also not running namespace-level setup and tear-down fixtures. Maybe this is part of the problem?

How do I fix this?

like image 842
Alex Reinking Avatar asked Jun 23 '18 18:06

Alex Reinking


1 Answers

This was a bug. JetBrains fixed it in ReSharper 2018.2 EAP 5. It's still finicky, but when it works, it works.

like image 90
Alex Reinking Avatar answered Oct 16 '22 01:10

Alex Reinking