【问题标题】:How to use ADO Rest API to get the list of test run in a specific build如何使用 ADO Rest API 获取特定构建中的测试运行列表
【发布时间】:2020-12-16 10:40:53
【问题描述】:

来自 ADO Rest API,https://docs.microsoft.com/en-us/rest/api/azure/devops/?view=azure-devops-rest-6.1,can,请告诉我如何获取特定构建的测试列表及其结果?

总之,我正在通过 REST API 在特定构建的“测试”选项卡中查找信息:

【问题讨论】:

    标签: azure-devops-rest-api


    【解决方案1】:

    首先,使用Runs - Query api并传递可选的build id来获取build中的测试运行ID:

    GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}&buildIds={buildIds}&api-version=6.0
    

    然后使用Results - List api获取测试运行的测试结果:

    GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=6.0
    

    【讨论】:

    • 如果我指定BuildId,我还需要在Runs - Query api中提供minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}吗?
    • 如果你不指定minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate},你会得到很多测试运行。
    • 每个测试都在一个作业下运行。每个作业都有自己的日志文件。我看到有一个 api 来获取构建日志。但是如何获得log id 的测试工作呢? docs.microsoft.com/en-us/rest/api/azure/devops/build/builds/…
    • 您可以使用Builds - Get Build Logs 获取日志ID。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-15
    • 2021-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-14
    • 1970-01-01
    相关资源
    最近更新 更多