jcansdale / TestDriven.Net-Issues

Issue tracking for TestDriven.Net
https://github.com/jcansdale/TestDriven.Net-Issues/issues
24 stars 2 forks source link

How to run on .net 4.7.2? #149

Closed sm-g closed 4 years ago

sm-g commented 5 years ago

After upgrade from

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
  </PropertyGroup>

to net472 I cannot run test with TestDriven:

=== ERROR IN TEST RUNNER: NUnit {0}.{1}.{2} ===
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Отсутствует реализация метода "get_TargetFramework" в типе "NUnit.Engine.Extensibility.ExtensionNode" из сборки "nunit.engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb".
   at NUnit.Engine.Services.ExtensionService..ctor()
   at NUnitTDNet.Adapter.EngineTestRunner..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at TestDriven.TestRunner.ProxyTestRunnerFactory.Create(String assemblyFile, String typeName, ApartmentState apartmentState)
   at TestDriven.TestRunner.ProxyTestRunnerFactory.Create(String assemblyFile, String typeName, ApartmentState apartmentState)
   at TestDriven.TestRunner.AppDomainTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyFile, String testPath)
   at TestDriven.TestRunner.Server.ServerTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)

But can via TestExplorer.

jcansdale commented 5 years ago

Could you attach an example project where this happens?

sm-g commented 5 years ago

@jcansdale https://github.com/sm-g/TDD-Kata-CSharp/tree/new-csproj

but in this repo TestExplorer also does not see any tests. Maybe it is nunit issue?..


Found that removing NUnit3TestAdapter solves the issue - TestDriven can execute tests.

PeteW commented 5 years ago

I found this also occurs using NUnit 3.11 .NET Framework 4.6.2 and, yes the Nunit3TestAdapter. And similar to @sm-g removing the Nunit3TestAdapter also solved the issue for me.

jcansdale commented 4 years ago

I'm tracking this issue in #153. Please see https://github.com/jcansdale/TestDriven.Net-Issues/issues/153#issuecomment-596105035 for a preview build with a fix. 🤞