【发布时间】:2018-03-30 05:32:30
【问题描述】:
我是使用 .NET 和 Visual Studio 的新手。我有一个包含 NUnit 测试的项目。我正在使用 Visual Studio 2015。测试适配器通过 Nuget 包管理器进行管理,使用的版本是 3.10.1。 package.config 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="3.5.0" targetFramework="net451" />
<package id="AutoMapper" version="4.2.1" targetFramework="net451" />
<package id="DelegateDecompiler" version="0.18.0" targetFramework="net451" />
<package id="DelegateDecompiler.EntityFramework" version="0.18.0" targetFramework="net451" />
<package id="EntityFramework" version="6.1.3" targetFramework="net451" />
<package id="GenericLibsBase" version="1.0.1" targetFramework="net451" />
<package id="GenericServices" version="1.0.9" targetFramework="net451" />
<package id="log4net" version="2.0.3" targetFramework="net451" />
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.SignalR.Core" version="2.0.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net451" />
<package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net451" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
<package id="Mono.Reflection" version="1.0.0.0" targetFramework="net451" />
<package id="Moq" version="4.2.1408.0717" targetFramework="net451" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net451" />
<package id="NUnit" version="3.10.1" targetFramework="net451" />
<package id="Owin" version="1.0" targetFramework="net451" />
</packages>
.csproj 文件还包含如下参考:
<Reference Include="nunit.framework, Version=3.10.1.0, Culture=neutral, PublicKeyToken=xxxxxxxx, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.10.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
本地运行测试时,所有测试都执行成功。
------ Run test started ------
NUnit Adapter 3.10.0.21: Test execution started
Running all tests in <path to release>\Tests.dll
NUnit3TestExecutor converted 54 of 54 NUnit test cases
NUnit Adapter 3.10.0.21: Test execution complete
========== Run test finished: 54 run (0:00:14.202451) ==========
下一个问题是尝试在 Visual Studio Team Services (VSTS) 的 Hosted VS 2017 环境中配置相同内容,并使用可用的构建模板构建项目。构建包括以下步骤:
- NuGet 工具安装程序
- NuGet 恢复
- 构建解决方案
- 执行 VSTest
- 发布工件
当我触发构建时,构建在第 4 步中失败。
2018-03-29T13:18:57.8600581Z vstest.console.exe
2018-03-29T13:18:57.8600783Z "<release path>\Tests.dll"
2018-03-29T13:18:57.8600996Z /EnableCodeCoverage
2018-03-29T13:18:57.8601174Z /logger:"trx"
2018-03-29T13:18:57.8949472Z Starting test execution, please wait...
2018-03-29T13:18:57.9616355Z Warning: Using Isolation mode to run the tests as diagnostic data adapters were enabled in the runsettings. Use the /inIsolation parameter to suppress this warning.
2018-03-29T13:19:13.6376907Z Warning: No test is available in <path to release>\Tests.dll. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
2018-03-29T13:19:13.6377691Z
2018-03-29T13:19:13.8424412Z
2018-03-29T13:19:13.8425192Z Attachments:
2018-03-29T13:19:13.8425592Z <path>\buildguest_FACTORYVM-AZ49 2018-03-29 13_19_05.coverage
2018-03-29T13:19:13.8425875Z
2018-03-29T13:19:13.8972522Z Information: Additionally, you can try specifying '/UseVsixExtensions' command if the test discoverer & executor is installed on the machine as vsix extensions and your installation supports vsix extensions. Example: vstest.console.exe myTests.dll /UseVsixExtensions:true
2018-03-29T13:19:13.9197235Z
2018-03-29T13:19:14.3324288Z ##[warning]No results found to publish.
2018-03-29T13:19:14.4972081Z ##[section]Finishing: Test - testAssemblies
是否有遗漏的其他配置?
【问题讨论】:
标签: asp.net-mvc continuous-integration nuget nunit azure-devops