示例#1
0
        /// <summary>
        /// Ends the test module.
        /// </summary>
        /// <param name="testModule">The test module.</param>
        /// <param name="result">The result.</param>
        /// <param name="exception">The exception.</param>
        /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
        /// <param name="globalStatistics">The global statistics for the module.</param>
        public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
        {
            TestModuleData currentTestModule = this.testItemStack.Pop() as TestModuleData;

            ExceptionUtilities.Assert(currentTestModule == testModule, "Invalid test module on stack.");

            this.WriteResult(result, exception);

            this.writer.WriteEndElement();

            this.writer.WriteStartElement("Summary");
            this.OutputCounts(globalStatistics);

            foreach (var kvp in statisticsByPriority.OrderBy(c => c.Key))
            {
                this.writer.WriteStartElement("Property");
                this.OutputCounts(kvp.Value);

                this.writer.WriteAttributeString("Name", "Pri");
                this.writer.WriteAttributeString("Value", XmlConvert.ToString(kvp.Key));
                this.writer.WriteEndElement();
            }

            this.writer.WriteEndElement();
            this.writer.Flush();
        }
        private void WriteResult(TestItemData testItem, TestResult result, ExceptionDetails exception)
        {
            if (exception != null)
            {
                this.WriteStatusText(LogLevel.Error, this.currentIndentLevel, this.ExceptionFormatter(exception));
            }

            this.Unindent();
            this.WriteStatusText(LogLevel.Info, this.currentIndentLevel, string.Format(CultureInfo.InvariantCulture, "{0} '{1}' {2}", this.GetItemTypeName(testItem), testItem.Metadata.Description, result.ToString()));
        }
示例#3
0
        /// <summary>
        /// Ends the variation.
        /// </summary>
        /// <param name="variation">The variation.</param>
        /// <param name="result">The result.</param>
        /// <param name="exception">The exception.</param>
        public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
        {
            var currentVariation = this.testItemStack.Pop();

            ExceptionUtilities.Assert(currentVariation == variation, "Invalid test case on stack.");

            this.WriteResult(result, exception);
            this.writer.WriteEndElement();
            this.writer.WriteString("\r\n");
            this.writer.Flush();
        }
示例#4
0
        private void WriteResult(TestResult result, ExceptionDetails exception)
        {
            if (result != TestResult.Passed && exception != null)
            {
                this.writer.WriteStartElement("Compare");
                this.writer.WriteAttributeString("Message", exception.Message);
                if (!string.IsNullOrEmpty(exception.Source))
                {
                    this.writer.WriteAttributeString("Source", exception.Source);
                }

                this.writer.WriteStartElement("Details");
                this.writer.WriteCData(this.ExceptionFormatter(exception));
                this.writer.WriteEndElement(); // Details

                this.writer.WriteElementString("Result", result.ToString().ToUpperInvariant());
                this.writer.WriteEndElement(); // Compare
            }

            this.writer.WriteElementString("Result", result.ToString().ToUpperInvariant());
        }
示例#5
0
        /// <summary>
        /// Ends the test case.
        /// </summary>
        /// <param name="testCase">The test case.</param>
        /// <param name="result">The result.</param>
        /// <param name="exception">The exception.</param>
        public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
        {
            var currentTestCase = this.testItemStack.Pop();

            ExceptionUtilities.Assert(testCase == currentTestCase, "Invalid test case on stack.");

            // Working around Aruba LTM driver bug with nested test cases. When we write an
            // end element for TestCase, the driver thinks we are now writing data about the
            // TestModule. This assumption is invalid because we could be processing nested TestCases.
            // If we have violated this assumption then writing the Result element will cause the
            // driver to think that this is the result for the TestModule and therefore stop processing
            // the log file. This workaround gets around most cases except for when a failure/warning/skip
            // occurs in TestCase.Terminate, or when a skip occurs in TestCase.Init.
            if (result != TestResult.Passed)
            {
                this.WriteResult(result, exception);
            }

            this.writer.WriteEndElement();
            this.writer.WriteString("\r\n");
            this.writer.Flush();
        }
 private static string FormatException(ExceptionDetails ex)
 {
     return(ex.ExceptionAsString);
 }
示例#7
0
 /// <summary>
 /// Ends the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
 {
 }
 /// <summary>
 /// Ends the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
 {
     this.WriteResult(variation, result, exception);
 }
 /// <summary>
 /// Ends the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
 {
     this.WriteResult(variation, result, exception);
 }
 /// <summary>
 /// Ends the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
 {
     this.ForAll(i => i.EndVariation(variation, result, exception));
 }
 /// <summary>
 /// Ends the test module.
 /// </summary>
 /// <param name="testModule">The test module.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
 /// <param name="globalStatistics">The global statistics for the module.</param>
 public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
 {
     this.ForAll(i => i.EndTestModule(testModule, result, exception, statisticsByPriority, globalStatistics));
 }
示例#12
0
 private static string FormatException(ExceptionDetails ex)
 {
     return ex.ExceptionAsString;
 }
示例#13
0
 /// <summary>
 /// Ends the test module.
 /// </summary>
 /// <param name="testModule">The test module.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
 /// <param name="globalStatistics">The global statistics for the module.</param>
 public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
 {
 }
示例#14
0
        /// <summary>
        /// Ends the test case.
        /// </summary>
        /// <param name="testCase">The test case.</param>
        /// <param name="result">The result.</param>
        /// <param name="exception">The exception.</param>
        public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
        {
            var currentTestCase = this.testItemStack.Pop();
            ExceptionUtilities.Assert(testCase == currentTestCase, "Invalid test case on stack.");

            // Working around Aruba LTM driver bug with nested test cases. When we write an
            // end element for TestCase, the driver thinks we are now writing data about the
            // TestModule. This assumption is invalid because we could be processing nested TestCases.
            // If we have violated this assumption then writing the Result element will cause the
            // driver to think that this is the result for the TestModule and therefore stop processing
            // the log file. This workaround gets around most cases except for when a failure/warning/skip
            // occurs in TestCase.Terminate, or when a skip occurs in TestCase.Init.
            if (result != TestResult.Passed)
            {
                this.WriteResult(result, exception);
            }

            this.writer.WriteEndElement();
            this.writer.WriteString("\r\n");
            this.writer.Flush();
        }
示例#15
0
        /// <summary>
        /// Ends the variation.
        /// </summary>
        /// <param name="variation">The variation.</param>
        /// <param name="result">The result.</param>
        /// <param name="exception">The exception.</param>
        public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
        {
            var currentVariation = this.testItemStack.Pop();
            ExceptionUtilities.Assert(currentVariation == variation, "Invalid test case on stack.");

            this.WriteResult(result, exception);
            this.writer.WriteEndElement();
            this.writer.WriteString("\r\n");
            this.writer.Flush();
        }
示例#16
0
        /// <summary>
        /// Ends the test module.
        /// </summary>
        /// <param name="testModule">The test module.</param>
        /// <param name="result">The result.</param>
        /// <param name="exception">The exception.</param>
        /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
        /// <param name="globalStatistics">The global statistics for the module.</param>
        public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
        {
            TestModuleData currentTestModule = this.testItemStack.Pop() as TestModuleData;
            ExceptionUtilities.Assert(currentTestModule == testModule, "Invalid test module on stack.");

            this.WriteResult(result, exception);

            this.writer.WriteEndElement();

            this.writer.WriteStartElement("Summary");
            this.OutputCounts(globalStatistics);

            foreach (var kvp in statisticsByPriority.OrderBy(c => c.Key))
            {
                this.writer.WriteStartElement("Property");
                this.OutputCounts(kvp.Value);

                this.writer.WriteAttributeString("Name", "Pri");
                this.writer.WriteAttributeString("Value", XmlConvert.ToString(kvp.Key));
                this.writer.WriteEndElement();
            }

            this.writer.WriteEndElement();
            this.writer.Flush();
        }
 /// <summary>
 /// Ends the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
 {
     this.WriteResult(testCase, result, exception);
 }
        private void WriteResult(TestItemData testItem, TestResult result, ExceptionDetails exception)
        {
            if (exception != null)
            {
                this.WriteStatusText(LogLevel.Error, this.currentIndentLevel, this.ExceptionFormatter(exception));
            }

            this.Unindent();
            this.WriteStatusText(LogLevel.Info, this.currentIndentLevel, string.Format(CultureInfo.InvariantCulture, "{0} '{1}' {2}", this.GetItemTypeName(testItem), testItem.Metadata.Description, result.ToString()));
        }
示例#19
0
 /// <summary>
 /// Ends the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
 {
     this.WriteResult(testCase, result, exception);
 }
示例#20
0
        private void WriteResult(TestResult result, ExceptionDetails exception)
        {
            if (result != TestResult.Passed && exception != null)
            {
                this.writer.WriteStartElement("Compare");
                this.writer.WriteAttributeString("Message", exception.Message);
#if !SILVERLIGHT
                if (!string.IsNullOrEmpty(exception.Source))
                {
                    this.writer.WriteAttributeString("Source", exception.Source);
                }
#endif

                this.writer.WriteStartElement("Details");
                this.writer.WriteCData(this.ExceptionFormatter(exception));
                this.writer.WriteEndElement(); // Details

                this.writer.WriteElementString("Result", result.ToString().ToUpperInvariant());
                this.writer.WriteEndElement(); // Compare
            }

            this.writer.WriteElementString("Result", result.ToString().ToUpperInvariant());
        }
示例#21
0
 /// <summary>
 /// Ends the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
 {
 }
示例#22
0
 /// <summary>
 /// Ends the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
 {
     this.ForAll(i => i.EndTestCase(testCase, result, exception));
 }
示例#23
0
 /// <summary>
 /// Ends the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
 {
 }
示例#24
0
 /// <summary>
 /// Ends the test module.
 /// </summary>
 /// <param name="testModule">The test module.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
 /// <param name="globalStatistics">The global statistics for the module.</param>
 public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
 {
     this.WriteTestItemDataDurationResult(testModule);
 }
 /// <summary>
 /// Ends the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndTestCase(TestItemData testCase, TestResult result, ExceptionDetails exception)
 {
     this.ForAll(i => i.EndTestCase(testCase, result, exception));
 }
示例#26
0
 /// <summary>
 /// Ends the test module.
 /// </summary>
 /// <param name="testModule">The test module.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
 /// <param name="globalStatistics">The global statistics for the module.</param>
 public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
 {
 }
示例#27
0
 /// <summary>
 /// Ends the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
 {
     this.ForAll(i => i.EndVariation(variation, result, exception));
 }
示例#28
0
 /// <summary>
 /// Ends the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 public void EndVariation(TestItemData variation, TestResult result, ExceptionDetails exception)
 {
 }
示例#29
0
 /// <summary>
 /// Ends the test module.
 /// </summary>
 /// <param name="testModule">The test module.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
 /// <param name="globalStatistics">The global statistics for the module.</param>
 public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary <int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
 {
     this.ForAll(i => i.EndTestModule(testModule, result, exception, statisticsByPriority, globalStatistics));
 }
示例#30
0
 /// <summary>
 /// Ends the test module.
 /// </summary>
 /// <param name="testModule">The test module.</param>
 /// <param name="result">The result.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="statisticsByPriority">The statistics for the module, broken down by priority.</param>
 /// <param name="globalStatistics">The global statistics for the module.</param>
 public void EndTestModule(TestModuleData testModule, TestResult result, ExceptionDetails exception, IDictionary<int, RunStatistics> statisticsByPriority, RunStatistics globalStatistics)
 {
     this.WriteTestItemDataDurationResult(testModule);
 }