可能是什么原因TFS 2015在传递MS Build参数时没有运行单元测试

时间:2017-02-14 23:07:05

标签: tfs2015

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

如果我在没有传递任何MS Build Arguments的情况下运行构建,我的构建工作已成功完成,并且它正在运行解决方案中包含的所有测试用例。 但是当我传递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 Build参数和单元测试)?

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

这是测试步骤输出:

2017-02-14T22:35:06.6488286Z Executing the powershell script: E:\agnt\tasks\VSTest\1.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\39

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\39\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\39\TestResults\6eaffd7e-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.

感谢任何建议/帮助!

1 个答案:

答案 0 :(得分:1)

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

enter image description here