TFS 2015 在传递 MS Build 参数时未进行 运行 单元测试的原因是什么

What can be reason TFS 2015 is not running unit tests while passing MS Build arguments

我正在使用基于 Web 的构建定义设置新的 tfs 构建定义。我遇到了单元测试用例的问题。

如果我 运行 构建时没有传递任何 MS 构建参数,我的构建就会成功完成,并且它 运行 解决方案中包含的所有测试用例。 但是当我传递 MS Build 参数时,它不会 运行 任何单元测试用例 - 只是忽略它并转到下一个构建步骤。可以是什么?

我正在构建 .NET 解决方案并传递 MS BUILD ARGUMENTS AS

(/p:DeployOnBuild=true /P:PackageTempRootDir=\Release /p:DeployIisAppPath="Default Web Site";DefaultPackageFileName=SampleApp.zip /p:OutputPath="$(Build.BinariesDirectory)$(BuildPlatform)$(BuildConfiguration)") 

这两个(MS 构建参数和单元测试)案例之间有什么联系吗?

我没有收到任何错误,在这两种情况下构建也都成功通过了。但是单元测试没有被执行。

这是测试步骤输出:

2017-02-14T22:35:06.6488286Z Executing the powershell script: E:\agnt\tasks\VSTest.0.32\VSTest.ps1

2017-02-14T22:35:07.4248374Z ##[debug]Calling Invoke-VSTest for all test assemblies

2017-02-14T22:35:07.6348369Z Working folder: E:\agnt\_work

2017-02-14T22:35:07.6348369Z Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "E:\agnt\_work\s\CaseAPI\Main\packages\Agero.TestRunner.1.0.0\lib\net45\Agero.TestsRunner.NUnit.dll"  /TestCaseFilter:"TestCategory!=Ignore" /EnableCodeCoverage /logger:trx

2017-02-14T22:35:07.8428336Z Microsoft (R) Test Execution Command Line Tool Version 14.0.25420.1

2017-02-14T22:35:07.8438332Z Copyright (c) Microsoft Corporation.  All rights reserved.

2017-02-14T22:35:07.9678332Z Starting test execution, please wait...

2017-02-14T22:35:08.0108349Z 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.

2017-02-14T22:35:16.0528901Z Attachments:

2017-02-14T22:35:16.0538895Z   E:\agnt\_work\TestResultseaffd7e-b2ac-4bc4-b356-41a2fda7bad9\csr1_B-TFSBC001WV 2017-02-14 17_35_10.coverage

2017-02-14T22:35:16.2028915Z 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

2017-02-14T22:35:16.3698948Z ##[warning]No results found to publish.

任何 advice/help 不胜感激!

由于你已经将OutputPath修改为$(Build.BinariesDirectory)$(BuildPlatform)$(BuildConfiguration),所以你还需要在VS测试任务中指定测试程序集为:$(Build.BinariesDirectory)$(BuildPlatform)$(BuildConfiguration)\*test*.dll: