Ejemplo n.º 1
0
        private void LogTest(TestStepFinishedEventArgs e)
        {
            TestOutcome outcome = e.TestStepRun.Result.Outcome;
            LogSeverity severity = GetLogSeverityForOutcome(outcome);
            string warnings = FormatStream(e.TestStepRun, MarkupStreamNames.Warnings);
            string failures = FormatStream(e.TestStepRun, MarkupStreamNames.Failures);

            var messageBuilder = new StringBuilder();
            messageBuilder.AppendFormat("[{0}] {1} {2}", outcome.DisplayName, e.GetStepKind(), e.TestStepRun.Step.FullName);

            if (warnings.Length != 0)
            {
                messageBuilder.AppendLine();
                messageBuilder.Append(warnings);
                messageBuilder.AppendLine();
            }

            if (failures.Length != 0)
            {
                messageBuilder.AppendLine();
                messageBuilder.Append(failures);
                messageBuilder.AppendLine();
            }

            Logger.Log(severity, messageBuilder.ToString());
        }
Ejemplo n.º 2
0
        private void LogTest(TestStepFinishedEventArgs e)
        {
            CodeLocation codeLocation = e.TestStepRun.Step.CodeLocation;
            TestOutcome outcome = e.TestStepRun.Result.Outcome;
            string description = String.Format("[{0}] {1} {2}", outcome.DisplayName, e.GetStepKind(), e.TestStepRun.Step.FullName);

            // Note: We exclude code location column information since it is not very useful in the build output.
            switch (outcome.Status)
            {
                case TestStatus.Passed:
                    taskLoggingHelper.LogMessage(MessageImportance.Normal, description);
                    break;

                case TestStatus.Failed:
                    taskLoggingHelper.LogError(null, null, null, codeLocation.Path, codeLocation.Line, codeLocation.Column, 0, 0, description);
                    break;

                case TestStatus.Skipped:
                case TestStatus.Inconclusive:
                    taskLoggingHelper.LogWarning(null, null, null, codeLocation.Path, codeLocation.Line, codeLocation.Column, 0, 0, description);
                    break;
            }
        }