相当于 Azure DevOps 中的 TeamCity 服务消息(用于自定义测试结果)

Equivalent to TeamCity service messages in Azure DevOps (for custom test results)

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

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

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

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

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

The general format for a logging command is:

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

To invoke a logging command, simply emit the command via standard output. For example, from a PowerShell task:

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

同意 JamesD Logging Commands in Azure Devops is equivalent to Service Messages 在 TeamCity 中的观点。

但目前 Logging Commands 不支持 'Reporting Tests' 操作,这会有所不同。在 Azure Devops 中可以考虑将 test-related 登录到 TEXT 文件(回显 CMD,Out-File 或 PS)或其他格式的文件中,然后使用 Upload log or Upload summary 命令显示test-related 信息。

例如:

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