如何使用 Azure DevOps .Net 客户端库为测试结果加载测试配置

问题描述 投票:0回答:0

我可以获得测试用例的测试结果,但是配置作为“ShallowReference”返回,所以我只获得了它的 Id。但是,我找不到任何方法来搜索测试配置。我可以在 REST API 中看到如何做到这一点。谢谢

您可以在下面看到 - 测试 Configuration.Name 始终为空。这以前与 GetTestRunsAsync 一起工作,但似乎不再可用

            var testCaseResults = _httpClient.GetTestResultsByQueryAsync(testQuery, Project,true).Result;
            
            if (testCaseResults.Results.Count == 0)
                throw new ApplicationException(String.Format("Test case {0} not found in project {1}", testCaseId, Project));

            //Just get the latest result
            var topResult = testCaseResults.Results.OrderByDescending(i => i.CompletedDate).FirstOrDefault();

            var output = new TestResult
            {
                RunBy = topResult.RunBy.DisplayName,
                LatestResult = topResult.Outcome,
                StartedDate = topResult.StartedDate,
                CompletedDate = topResult.CompletedDate,
                Configuration = topResult.Configuration.Name
            };
azure-devops-rest-api azure-devops-server-2019
© www.soinside.com 2019 - 2024. All rights reserved.