0

I am beginner in SpecFlow. I am unable to run SpecFlow features through console file.

My NUnit Versions:

  • NUnit - 3.13.1
  • NUnit3TestAdapter - 3.17.0
  • NUnit.ConsoleRunner - 3.11.1
  • NUnit.Console - 3.11.1

enter image description here

C:\Users\.nuget\packages\nunit.consolerunner\3.11.1\tools>nunit3-console.exe D:\automation\bin\Debug\netcoreapp3.1\automation.dll
NUnit Console Runner 3.11.1 (.NET 2.0)
Copyright (c) 2020 Charlie Poole, Rob Prouse
27 October 2021 10:43:34

Runtime Environment
OS Version: Microsoft Windows NT 6.2.9200.0
Runtime: .NET Framework CLR v4.0.30319.42000

Test Files

D:\automation\bin\Debug\netcoreapp3.1\automation.dll

Errors, Failures and Warnings

1) Error :
NUnit.Engine.NUnitEngineException : The NUnit 3 driver encountered an error while executing reflected code.
----> System.InvalidCastException : Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'.
--NUnitEngineException
The NUnit 3 driver encountered an error while executing reflected code.

Server stack trace:
at NUnit.Engine.Drivers.NUnit3FrameworkDriver.CreateObject(String typeName, Object[] args)
at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
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)
--
InvalidCastException
Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'.
at NUnit.Framework.Api.FrameworkController.LoadTestsAction..ctor(FrameworkController controller, Object handler)

Test Run Summary
Overall result: Failed
Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2021-10-27 05:13:36Z
End time: 2021-10-27 05:13:44Z
Duration: 7.759 seconds

Results (nunit3) saved as TestResult.xml

Can you please help on this.

Thank you.

Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92
Kiran
  • 1
  • 2

1 Answers1

0

NUnit3 Console Runner is not yet able to run .NET Core tests. Options for running your netcoreapp3.1 targeted test are:

  1. Run using the separately available package `NUnit.ConsoleRunner.NetCore
  2. Run under Visual Studio test explorer using the NUnit3 adapter
  3. Run under vstest.exe using the NUnit3 adapter
  4. Run using NUnitLite
  5. Run using the TestCentric GUI for NUnit.

Note that option 1 is available as a beta release only. A future release of the NUnit3 console runner will be able to run a mix of .NET Framework and .NET Core tests.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • Throwing an exception while running tests using vstest An exception occurred while invoking executor 'executor://specrun/executorV3.9.7': Exception has been thrown by the target of an invocation. – Kiran Nov 05 '21 at 12:31
  • Stack trace: at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor) at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions) at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) – Kiran Nov 05 '21 at 12:34
  • Other SO users may need the answer about running .NET Core tests under nunit3-console. It's better to start a new question, with full information about running under vstest.exe. You should include version info and any .runsettings you use in that question. – Charlie Nov 06 '21 at 13:43