Esempio n. 1
0
                private static TestCase ParseTestCase(TreeNode testNode)
                {
                    TestCase testResult = new TestCase();
                    testNode.Get<Label>("TestListViewDisplayNameTextBlock").Click();
                    testNode.Nodes.Count.Should().Be(0, "Test case tree node expected to have no children.");

                    SearchCriteria isControlTypeLabel = SearchCriteria.ByControlType(typeof(Label), WindowsFramework.Wpf);
                    // ReSharper disable once PossibleInvalidCastExceptionInForeachLoop
                    foreach (Label label in GetTestExplorerDetailsPanel().GetMultiple(isControlTypeLabel))
                    {
                        if (label.IsOffScreen || string.IsNullOrWhiteSpace(label.Text))
                            continue;

                        AddInfoFromDetailPane(testResult, label);
                    }

                    return testResult;
                }
Esempio n. 2
0
        private TestGroup() { } // only to make XmlSerializer happy

        public void Add(TestCase tr) { testCases.Add(tr); }
Esempio n. 3
0
 private static void AddInfoFromDetailPane(TestCase testResult, Label label)
 {
     var id = label.AutomationElement.Current.AutomationId;
     switch (id)
     {
         case "detailPanelHeader":
             var name = NormalizePointerInfo(label.Text);
             testResult.Name += name;
             if (label.Text != label.HelpText)
                 testResult.FullyQualifiedName += label.HelpText;
             break;
         case "hasSourceToolTip":
             testResult.Source += label.Text;
             break;
         case "testResultSummaryText Failed":
         case "testResultSummaryText Skipped":
         case "testResultSummaryText Passed":
             testResult.Result += NormalizePointerInfo(label.Text);
             break;
         case "errorMessageItem":
             testResult.Error += label.Text.ReplaceIgnoreCase(Path.GetDirectoryName(SolutionFile), "$(SolutionDir)");
             break;
         case "hyperlinkText":
             testResult.Stacktrace = label.Text.ReplaceIgnoreCase(Path.GetDirectoryName(SolutionFile), "$(SolutionDir)");
             break;
         case "sourceTextHeader":
         case "noSourceAvailableToolTip":
         case "elapsedTimeText":
         case "Stacktraceheader":
         case "StackFramePanel":
             // ignore
             break;
         default:
             testResult.Unexpected += $"{id}={label.Text} ";
             break;
     }
 }