带有 SonarCloud 的 Azure DevOps 找不到测试

Azure DevOps with SonarCloud not finding tests

我正在将 SonarCloud 与 AzureDevops 结合使用。

我的 YAML 文件中的序列是:

  1. 恢复 NuGet
  2. 声纳准备
  3. 构建解决方案
  4. 运行 测试
  5. 声纳分析
  6. 声纳发布

我没有指定任何输出位置(至少,我不知道)。

当测试 运行 时,我得到以下输出:

Test results files: d:\a_temp\TestResults\VssAdmin.....trx

但是当声纳分析步骤执行时,我得到以下输出:

Looking for TRX files in: d:\a\TestResults

所以....路径不匹配。

我:

我猜第二个选项可能更容易 - 在我尚未设置的不同解决方案中,有很多测试项目....

谢谢

那是因为在 VSTest 任务中,测试结果默认存储在 $(Agent.TempDirectory)/TestResults 中。您可以将其更改为 $(Common.TestResultsDirectory).