在VSTS中未发现.NET Core 2.0 xUnit测试

Ken*_*nci 3 xunit azure-devops

我试图建立与.NET Core 2.0项目和xUnit的VSTS持续集成.

我已经安装了xunit.runner.visualstudio NuGet包,并且在Visual Studio中一切正常.

VSTS无法找到任何测试.

到目前为止我能找到的是本文,它使用project.json描述了如何使用.NET Core 1.0进行设置.不幸的是,它不会工作,因为project.json在.NET Core 2.0中消失了.

有什么建议?

VSTS输出:

2017-11-08T20:00:30.4824989Z ## [section]开始:VsTest - testAssemblies 2017-11-08T20:00:30.4834988Z ==================== ================================================== ======== 2017-11-08T20:00:30.4834988Z任务:Visual Studio测试2017-11-08T20:00:30.4834988Z描述:使用Visual Studio测试运行器运行测试2017-11-08T20:00: 30.4834988Z版本:2.2.3 2017-11-08T20:00:30.4834988Z作者:Microsoft Corporation 2017-11-08T20:00:30.4834988Z帮助:更多信息 2017-11-08T20:00:30.4834988Z ===== ================================================== ======================= 2017-11-08T20:00:31.2064989Z使用vstest.console.exe在本地运行测试2017-11-08T20:00 :31.2064989Z =============================================== ========= 2017-11-08T20:00:31.2074983Z测试选择器:测试组件2017-11-08T20:00:31.2084986Z测试组件: \ release*test*.dll,\release \netcoreapp2. 0*单位*.dll, - :\ xunit.runner.visualstudio.testadapter.dll ,! \ obj**2017-11-08T20:00:31.2084986Z测试筛选条件:null 2017-11-08T20:00:31.2094992Z搜索文件夹:d:\ a\1\s 2017-11-08T20:00:31.2094992Z运行设置文件:d:\ a\1\s 2017-11-08T20:00:31.2094992Z并行运行:false 2017-11-08T20:00:31.2115263Z隔离运行:false 2017-11-08T20:00: 31.2184982Z自定义适配器的路径:null 2017-11-08T20:00:31.2194992Z其他控制台选项:null 2017-11-08T20:00:31.2194992Z启用代码覆盖率:false 2017-11-08T20:00:31.2205509Z VisualStudio版本选择用于测试执行:最新2017-11-08T20:00:32.3430734Z ================================== ====================== 2017-11-08T20:00:38.4660600Z [command]"C:\ Program Files(x86)\ Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"@d:\ a_temp\7a0ab851-c4bf-11e7-9264-0bc93cd5677b.txt 2017-11-08T20:00:38.6420650Z Microsoft(R)测试执行命令行工具版本15.0.26929.2 2017-11-08T20:00:38.6420650Z版权所有(c)Mic 罗斯托夫公司.版权所有.2017-11-08T20:00:38.6420650Z 2017-11-08T20:00:38.6420650Z vstest.console.exe 2017-11-08T20:00:38.6430604Z"d:\ a\1\s\Salgsapp\MyTestProject.Business .Unit\bin\Release \netcoreapp2.0\MyTestProject.Business.Unit.dll"2017-11-08T20:00:38.6430604Z"d:\ a\1\s\Salgsapp\MyTestProject.Business.Unit\bin\Release \netcoreapp2.0\xunit.runner.reporters.netcoreapp10.dll"2017-11-08T20:00:38.6430604Z"d:\ a\1\s\Salgsapp\MyTestProject.Business.Unit\bin\Release \netcoreapp2.0\xunit.runner.u力.netcoreapp10.dll"2017-11-08T20:00:38.6430604Z"d:\ a\1\s\Salgsapp\MyTestProject.Business.Unit\bin\Release \netcoreapp2.0\xunit.runner .visualstudio.dotnetcore.testadapter.dll"2017-11-08T20:00:38.6430604Z/logger:"trx"2017-11-08T20:00:38.6430604Z/TestAdapterPath:"d:\ a\1\s"2017- 11-08T20:00:39.2010599Z开始测试执行,请稍候...... 2017-11-08T20:00:39.7672139Z警告:d:\ a\1\s\Salgsapp\MyTestProject.Business.Unit中没有测试可用\ bin\Release \netcoreapp2.0\MyTestProject.Business.Unit.dll d:\ a\1\s\Salg sapp\MyTestProject.Business.Unit\bin\Release \netcoreapp2.0\xunit.runner.reporters.netcoreapp10.dll d:\ a\1\s\Salgsapp\MyTestProject.Business.Unit\bin\Release \netcoreapp2.0\xunit.runner.utility.netcoreapp10.dll d:\ a\1\s\Salgsapp\MyTestProject.Business.Unit\bin\Release \netcoreapp2.0\xunit.runner.visualstudio.dotnetcore.testadapter.dll.确保已安装的测试发现者和执行者,平台和框架版本设置适当,然后重试.2017-11-08T20:00:39.7682139Z 2017-11-08T20:00:39.7812142Z 2017-11-08T20:00:40.6140742Z信息:此外,如果测试发现者和执行者是,则可以尝试指定'/ UseVsixExtensions'命令作为vsix扩展安装在计算机上,您的安装支持vsix扩展.示例:vstest.console.exe myTests.dll/UseVsixExtensions:true 2017-11-08T20:00:40.6140742Z 2017-11-08T20:00:43.0551327Z ## [警告]未找到结果发布.2017-11-08T20:00:43.0711309Z ## [section]表面处理:VsTest - testAssemblies

项目定义:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
    <PackageReference Include="Moq">
      <Version>4.7.142</Version>
    </PackageReference>
    <PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
    <PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
    <PackageReference Include="xunit">
      <Version>2.3.1</Version>
    </PackageReference>
    <PackageReference Include="xunit.runner.visualstudio">
      <Version>2.3.1</Version>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\MyTestProject.Business\MyTestProject.Business.csproj" />
  </ItemGroup>

</Project>
Run Code Online (Sandbox Code Playgroud)

构建配置:

在此输入图像描述

sta*_*SFT 5

您需要在Visual Studio Test任务中的IED\Extensions\TestPlatform文件夹和框架选项中指定vstest.console.exe:

在此输入图像描述