我正在尝试使用.NET Core 2.0项目和xUnit设置VSTS持续集成。
我安装了xunit.runner.visualstudio NuGet包,一切都在Visual Studio中运行良好。
VSTS无法找到任何可以运行的测试。
到目前为止我能找到的是this article,它描述了如何使用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 test runner 2017-11-08T20:00:30.4834988Z版本:2.2.3 2017-11-08T20:00:30.4834988Z作者:微软公司 2017-11-08T20:00:30.4834988Z帮助:More Information 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测试组件: \释放*测试* .DLL, \发布\ 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 工作室\ 2017年\企业\ Common7 \ IDE \ CommonExtensions \微软\ 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) 微软公司。版权所有。 2017-11-08T20:00:38.6420650Z 2017-11-08T20:00:38.6420650Z vstest.console.exe 2017-11-08T20:00:38.6430604Z “d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ netcoreapp2.0 \ MyTestProject.Business.Unit.dll” 2017-11-08T20:00:38.6430604Z “d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ netcoreapp2.0 \ xunit.runner.reporters.netcoreapp10.dll” 2017-11-08T20:00:38.6430604Z “d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ netcoreapp2.0 \ xunit.runner.utility.netcoreapp10.dll” 2017-11-08T20:00:38.6430604Z “d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ 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:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ netcoreapp2.0 \ MyTestProject.Business.Unit.dll d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ netcoreapp2.0 \ xunit.runner.reporters.netcoreapp10.dll d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ netcoreapp2.0 \ xunit.runner.utility.netcoreapp10.dll d:\一个\ 1 \ S \ Salgsapp \ MyTestProject.Business.Unit \ BIN \发布\ 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>
构建配置: