示例#1
0
        void ITestExecutionRecorder.RecordResult(TestResult testResult)
        {
            results?.Add(testResult);
            var innerResultsCount = GetProperty <int>("InnerResultsCount", testResult, 0);
            var parentExecId      = GetProperty <Guid>("ParentExecId", testResult, Guid.Empty);
            var test = tests[testResult.TestCase.Id];

            if (parentExecId == Guid.Empty) // We don't report child result in the UI
            {
                test.Result = testResult;

                OnPropertyChanged(nameof(Progress));
                OnPropertyChanged(nameof(Percentage));
                OnPropertyChanged(nameof(TestStatus));
                OnPropertyChanged(nameof(NotRunTests));
                OnPropertyChanged(nameof(PassedTests));
                OnPropertyChanged(nameof(FailedTests));
                OnPropertyChanged(nameof(SkippedTests));
            }
            else
            {
                if (test.ChildResults == null)
                {
                    test.ChildResults = new System.Collections.ObjectModel.ObservableCollection <TestResult>();
                    test.OnPropertyChanged(nameof(TestResultVM.ChildResults));
                }
                test.ChildResults.Add(testResult);
            }
            Log($"Completed test '{testResult.TestCase.FullyQualifiedName}': {testResult.Outcome} {testResult.ErrorMessage}");
            trxWriter?.RecordResult(testResult);
            Settings.TestRecorder?.RecordResult(testResult);
            Logger.LogResult(testResult);
        }
示例#2
0
        void ITestExecutionRecorder.RecordResult(TestResult testResult)
        {
            results?.Add(testResult);
            var innerResultsCount = GetProperty <int>("InnerResultsCount", testResult, 0);
            var parentExecId      = GetProperty <Guid>("ParentExecId", testResult, Guid.Empty);
            var test = tests[testResult.TestCase.Id];

            if (parentExecId == Guid.Empty) // We don't report child result in the UI
            {
                test.Result = testResult;

                OnPropertyChanged(nameof(Progress));
                OnPropertyChanged(nameof(Percentage));
                OnPropertyChanged(nameof(TestStatus));
                OnPropertyChanged(nameof(NotRunTests));
                OnPropertyChanged(nameof(PassedTests));
                OnPropertyChanged(nameof(FailedTests));
                OnPropertyChanged(nameof(SkippedTests));
                if (innerResultsCount > 0) // Prep the child results getting reported immediately after this one
                {
                    test.ChildResults = new List <TestResult>(innerResultsCount);
                }
            }
            else
            {
                test.ChildResults.Add(testResult);
                test.OnPropertyChanged(nameof(TestResultVM.ChildResults));
            }
            Log($"Completed test '{testResult.TestCase.FullyQualifiedName}': {testResult.Outcome} {testResult.ErrorMessage}");
            if (testResult.Attachments.Count > 0)
            {
                connection?.SendAttachments(testResult.Attachments, Settings.TestRunDirectory);
                Settings.TestRecorder?.RecordAttachments(testResult.Attachments);
            }
            trxWriter?.RecordResult(testResult);
            Logger.LogResult(testResult);
            connection?.SendTestEndResult(testResult);
            Settings.TestRecorder?.RecordResult(testResult);

            if (test.ChildResults == null || test.ChildResults.Count == test.ChildResultCount)
            {
                // Single test or complete set of datarows: Save
                SaveProgress(new TestResultVM[] { test }, true);
            }
        }