TFS Visual Studio测试任务"没有发现结果发布。"设置"覆盖TestRun参数"

时间:2017-08-30 03:48:18

标签: visual-studio unit-testing tfs tfsbuild azure-pipelines

我有一个带有runsettings文件的VS 2017单元测试。

  <TestRunParameters>
    <Parameter name="Url" value="http://dev-foo-app:8080/tws/service/foowebservices/" />
    <Parameter name="Fileset" value="O" />
    <Parameter name="Loop" value="1" />
  </TestRunParameters>

Visual Studio测试任务中,我在覆盖TestRun参数中设置循环= 10 。构建运行后,我会查看测试标签,并查看: 此版本没有可用的测试运行。通过添加Visual Studio测试任务

在您的构建定义中启用自动化测试

如果我将覆盖TestRun参数留空,我可以看到在测试选项卡中运行的所有测试。

测试任务日志:

Executing the powershell script: D:\TfsBuildAgents\VsoBuildAgent\tasks\VSTest\1.0.32\VSTest.ps1
##[debug]Calling Invoke-VSTest for all test assemblies
Working folder: D:\TfsData\Build\CamsPool\vsoAgent\_work\69
Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s\TWS.Test\foo Web Services\Tws.Test\bin\Release\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll" "D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s\TWS.Test\foo Web Services\Tws.Test\bin\Release\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll" "D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s\TWS.Test\foo Web Services\Tws.Test\bin\Release\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll" "D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s\TWS.Test\foo Web Services\Tws.Test\bin\Release\Microsoft.VisualStudio.TestPlatform.TestFramework.dll" "D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s\TWS.Test\foo Web Services\Tws.Test\bin\Release\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll" "D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s\TWS.Test\foo Web Services\Tws.Test\bin\Release\Tws.Test.dll"  /Settings:"D:\TfsData\Build\CamsPool\vsoAgent\_work\69\TestResults\test_2017-08-30_12-22-00-AM.runsettings" /logger:trx /TestAdapterPath:"D:\TfsData\Build\CamsPool\vsoAgent\_work\69\s"
Microsoft (R) Test Execution Command Line Tool Version 14.0.23107.0
Copyright (c) Microsoft Corporation.  All rights reserved.
Starting test execution, please wait...
Warning: Input string was not in a correct format. 
Warning: Input string was not in a correct format.
Passed   , 
Results File: D:\TfsData\Build\CamsPool\vsoAgent\_work\69\TestResults\TestResults\tfsbuild_foo-TFS-APP1 2017-08-30 00_22_03.trx
Total tests: 11. Passed: 11. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 16.2318 Seconds
##[warning]No results found to publish.

1 个答案:

答案 0 :(得分:0)

这是一个非常恼人的解决方法:

在* .runsettings文件更改中:

<ResultsDirectory>.\TestResults</ResultsDirectory>

 <ResultsDirectory></ResultsDirectory>

在我的情况下,这意味着我必须为我的构建的所有实例设置一个值。如果省略覆盖TestRun参数,测试任务将以不同的方式失败 - 并且没有明显的原因。