首页 > 解决方案 > xUnit 测试 - 使用 yml 配置时,所有测试均未在 Azure 上运行

问题描述

我有一个使用 .NET Framework 4.7 的 .NET 应用程序,其中包括 xUnit 单元测试框架。应用程序和单元测试从我的本地开发环境和使用 .net 解决方案构建的 Azure 按预期执行。

我最近向 Azure 添加了另一个基于 yml 文件的构建,它正在构建相同的代码并执行相同的单元测试,但是,使用 yml 配置执行的单元测试的数量有很大的不同,近一半的单元测试不是使用 yml 配置时执行。yml 文件非常简单,这是我开始故障排除工作的第一个地方,如果需要,我很乐意分享。

对解决方案构建与 yml 构建之间的测试结果的审查表明以下警告仅出现在 yml 单元测试结果中:

Warning 5/14/2020 1:46:33 PM    [MSTest][Discovery][d:\a\1\s\src\OTEMS\packages\MSTest.TestAdapter.2.1.0\build\netcoreapp1.0\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll] Unable to load types from the test source 'd:\a\1\s\src\OTEMS\packages\MSTest.TestAdapter.2.1.0\build\netcoreapp1.0\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll'. Some or all of the tests in this source may not be discovered.
Error: System.TypeLoadException: Method 'get_DataRow' in type 'Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestContextImplementation' from assembly 'Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation.

注意\netcoreapp1.0\路径中的。此警告仅在 yml 变体中出现,但该项目不是 .net 核心构建,我似乎无法找到它被引用的位置或者它是否是实际问题。

标签: c#azureunit-testingxunit

解决方案


推荐阅读