【问题标题】:Equivalent to TeamCity service messages in Azure DevOps (for custom test results)等效于 Azure DevOps 中的 TeamCity 服务消息(用于自定义测试结果)
【发布时间】:2020-10-01 15:19:06
【问题描述】:

TeamCity 支持 "service messages" to report test results 用于非标准测试套件。自定义测试脚本会打印 ##teamcity[testStarted name='testName' captureStandardOutput='true'] 之类的内容以报告测试结果。

Azure DevOps Pipelines 中是否有等效功能?

【问题讨论】:

    标签: build azure-devops automated-tests teamcity


    【解决方案1】:

    同意 JamesD 的观点,即 Azure Devops 中的 Logging Commands 等同于 TeamCity 中的 Service Messages

    但目前Logging Commands 不支持“报告测试”操作,这会有所不同。在 Azure Devops 中可以考虑将测试相关的信息记录到 TEXT 文件(CMD、Out-File 或 PS 的回显)或其他格式文件中,然后使用Upload logUpload summary 命令显示测试相关信息。

    例如:

    Write-Host "##vso[task.uploadsummary]filepath"
    Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=TestSummary;]$(System.DefaultWorkingDirectory)\filepath"
    

    【讨论】:

      【解决方案2】:

      我认为这是 Azure Pipelines 支持的各种服务消息的权威参考:

      https://github.com/microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md

      取自上述网站,一般语法为:

      记录命令的一般格式是:

      ##vso[area.action property1=value;property2=value;...]message

      要调用日志记录命令,只需通过标准发出命令 输出。例如,来自 PowerShell 任务:

      Write-Host "##vso[task.setvariable variable=testvar;]testvalue"

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-06-03
        • 2021-06-25
        • 2019-04-03
        • 1970-01-01
        • 1970-01-01
        • 2020-06-04
        • 2021-06-22
        • 1970-01-01
        相关资源
        最近更新 更多