CoreApp2.0的nunit3问题

时间:2018-11-10 21:50:51

标签: nunit asp.net-core-2.0

我尝试用蛋糕运行nunit测试(并手动进行)。我有以下.csproj

  <ItemGroup>
    <PackageReference Include="NUnit" Version="3.9.0" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' != 'net40' and '$(TargetFramework)' != 'net45'">
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
  </ItemGroup>

当我执行以下命令时:     nunit3-console.exe myDLL.Test.dll

以下蛋糕脚本存在相同问题

var settings = new NUnit3Settings();
NUnit3(testAssembly.ToString(), settings);

我有以下堆栈跟踪

1) Error :
NUnit.Engine.NUnitEngineException : The NUnit 3 driver cannot support this test assembly. Use a platform specific runner.
  ----> System.Runtime.Serialization.SerializationException : Le type 'NUnit.Framework.Api.FrameworkController' dans l'assembly 'nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' n'est pas marqué comme sérialisable.
--NUnitEngineException
The NUnit 3 driver cannot support this test assembly. Use a platform specific runner.

Server stack trace:
   à NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
   à NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
   à NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
   à NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
   à NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   à System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   à System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

我该如何解决?谢谢

0 个答案:

没有答案