我有这个.NET Core 1.1解决方案,包括一个ASP.NET核心项目和一个NUnit测试项目。每个项目都有必要的属性(如果有必要,我可以展示更多)。
class C
我可以在本地恢复,构建和运行测试套件(Windows 10),没有任何问题。
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
</PropertyGroup>
测试套件在所有最新稳定版本上使用NUnit 3和I&#m; m。这是有趣的包装参考。
$ dotnet restore
Restoring packages for...
Restore completed in...
Generating MSBuild file...
$ dotnet build
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Example -> ...
Test -> ...
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed ...
$ cd test/
$ dotnet test
Build started, please wait...
Build completed.
Test run for ...
Microsoft (R) Test Execution Command Line Tool Version 15.3.0-preview-20170628-02
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
NUnit Adapter 3.8.0.0: Test execution started
Running all tests in ...
NUnit3TestExecutor converted 11 of 11 NUnit test cases
Total tests: 11. Passed: 11. Failed: 0. Skipped: 0.
Test Run Succeeded.
Test execution time: ...
但是,当我从.NET Core SDK Docker映像/容器运行测试时,它们会显着失败!
中止了主动测试运行。原因:无法与测试主机进程通信。
这是简单的Dockerfile
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.3" />
<PackageReference Include="FluentAssertions" Version="4.19.3" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="1.1.3" />
<PackageReference Include="NUnit" Version="3.8.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.8.0" />
恢复和构建工作查找,但测试中止了!
FROM microsoft/dotnet:1.1-sdk
WORKDIR /app
COPY . .
搜索此错误消息让我无处可寻。我不确定如何调试测试运行中止。更高级别的详细程度不会打印任何有用的东西。让我知道我可以尝试获取更多信息,消除可能性并提供更多有用的信息!