Example #1
0
 public HelixWorkItem(TestRunInfo testRunInfo, HelixInfo helixInfo, TestCaseResult testCaseResult)
 {
     Debug.Assert(HelixUtil.TryGetHelixInfo(testCaseResult) == helixInfo);
     TestRunInfo    = testRunInfo;
     HelixInfo      = helixInfo;
     TestCaseResult = testCaseResult;
 }
 public DotNetTestCaseResult(TestRunInfo testRunInfo, HelixWorkItem helixWorkItem, TestCaseResult testCaseResult)
 {
     Debug.Assert(HelixUtil.TryGetHelixInfo(testCaseResult) == helixWorkItem.HelixInfo);
     TestRunInfo    = testRunInfo;
     HelixWorkItem  = helixWorkItem;
     TestCaseResult = testCaseResult;
 }
Example #3
0
            static async Task <DotNetTestRun> GetDotNetTestRunAsync(DevOpsServer server, Build build, TestRun testRun, TestOutcome[] outcomes)
            {
                var all = await server.ListTestResultsAsync(build.Project.Name, testRun.Id, outcomes : outcomes).ConfigureAwait(false);

                var info = new TestRunInfo(build, testRun);
                var list = ToDotNetTestCaseResult(info, all.ToList());

                return(new DotNetTestRun(info, new ReadOnlyCollection <DotNetTestCaseResult>(list)));
            }
Example #4
0
            static List <DotNetTestCaseResult> ToDotNetTestCaseResult(TestRunInfo testRunInfo, List <TestCaseResult> testCaseResults)
            {
                var list = new List <DotNetTestCaseResult>();

                foreach (var testCaseResult in testCaseResults)
                {
                    var helixInfo = HelixUtil.TryGetHelixInfo(testCaseResult);
                    if (helixInfo is null)
                    {
                        list.Add(new DotNetTestCaseResult(testRunInfo, testCaseResult));
                        continue;
                    }

                    if (HelixUtil.IsHelixWorkItem(testCaseResult))
                    {
                        var helixWorkItem = new HelixWorkItem(testRunInfo, helixInfo.Value, testCaseResult);
                        list.Add(new DotNetTestCaseResult(testRunInfo, helixWorkItem, testCaseResult));
                    }
                    else
                    {
                        var workItemTestCaseResult = testCaseResults.FirstOrDefault(x => HelixUtil.IsHelixWorkItemAndTestCaseResult(workItem: x, test: testCaseResult));
                        if (workItemTestCaseResult is null)
                        {
                            // This can happen when helix errors and doesn't fully upload a result. Treat it like
                            // a normal test case
                            list.Add(new DotNetTestCaseResult(testRunInfo, testCaseResult));
                        }
                        else
                        {
                            var helixWorkItem = new HelixWorkItem(testRunInfo, helixInfo.Value, workItemTestCaseResult);
                            list.Add(new DotNetTestCaseResult(testRunInfo, helixWorkItem, testCaseResult));
                        }
                    }
                }

                return(list);
            }
Example #5
0
 public DotNetTestRun(TestRunInfo testRunInfo, ReadOnlyCollection <DotNetTestCaseResult> testCaseResults)
 {
     TestRunInfo     = testRunInfo;
     TestCaseResults = testCaseResults;
 }
 public DotNetTestCaseResult(TestRunInfo testRunInfo, TestCaseResult testCaseResult)
 {
     TestRunInfo    = testRunInfo;
     TestCaseResult = testCaseResult;
 }