Exemplo n.º 1
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.testItemStack.Push(variation);
     this.writer.WriteStartElement("Variation");
     this.writer.WriteAttributeString("Pri", XmlConvert.ToString(variation.Metadata.Priority));
     this.writer.WriteAttributeString("Id", XmlConvert.ToString(variation.Metadata.Id));
     this.writer.WriteAttributeString("Desc", variation.Metadata.Description);
     this.writer.WriteString("\r\n");
     this.writer.Flush();
 }
Exemplo n.º 2
0
        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()));
        }
Exemplo n.º 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();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Begins the test case.
        /// </summary>
        /// <param name="testCase">The test case.</param>
        public void BeginTestCase(TestItemData testCase)
        {
            this.testItemStack.Push(testCase);
            var metadata = testCase.Metadata;

            this.writer.WriteStartElement("TestCase");
            this.writer.WriteAttributeString("Name", metadata.Name);
            this.writer.WriteAttributeString("Desc", metadata.Description);
            this.writer.WriteString("\r\n");
            this.writer.Flush();
        }
Exemplo n.º 5
0
        private void WriteTestItemDataDurationResult(TestItemData testItem)
        {
            var currentTestCaseWithTime = this.testItemTimeStack.Pop();

            ExceptionUtilities.Assert(testItem == currentTestCaseWithTime.Key, "Invalid test case on stack.");

            var elapsed = this.GetCurrentTime() - currentTestCaseWithTime.Value;

            bool writeOutInitTerminateTime = false;

            // Adding information on whether the information recorded is for a Variation - V, TestCase - TC, or TestModule - TM
            string type = "V";

            if (testItem.IsTestCase)
            {
                type = "TC";
                writeOutInitTerminateTime = true;
            }
            else if (testItem is TestModuleData)
            {
                type = "TM";
                writeOutInitTerminateTime = true;
            }

            // Getting TestCase Name, escaping the commas as it makes it more difficult
            // to import into excel
            var nestedName = this.GetNestedTestName(currentTestCaseWithTime.Key).Replace(',', ';');

            this.writer.WriteLine("{0}, {1}, {2}", type, nestedName, elapsed.TotalMilliseconds);

            // Add to running total of time if there is a parent
            if (testItem.Parent != null)
            {
                this.testItemRunningTotalLookup[testItem.Parent] = this.testItemRunningTotalLookup[testItem.Parent] + elapsed.TotalMilliseconds;
            }

            if (writeOutInitTerminateTime)
            {
                var runningTotal        = this.testItemRunningTotalLookup[testItem];
                var startupTearDownTime = elapsed.TotalMilliseconds - runningTotal;

                // Write out the time that occurs between running the parent test and the child tests
                this.writer.WriteLine("{0}, {1}, {2}", type + "_I-T", nestedName, startupTearDownTime);
            }

            // Remove this item as its unneeded now
            this.testItemRunningTotalLookup.Remove(testItem);

            this.writer.Flush();
        }
        private bool ShouldRun(TestItemData testItemData)
        {
            if (this.executionThreadAborted)
            {
                return(false);
            }

            if (testItemData.IsVariation)
            {
                return(this.scheduledVariations.ContainsKey(testItemData));
            }
            else
            {
                return(testItemData.Children.Any(i => this.ShouldRun(i)));
            }
        }
Exemplo n.º 7
0
        private string GetItemTypeName(TestItemData testItem)
        {
            string itemKind = string.Empty;

            if (testItem.IsVariation)
            {
                itemKind = "Variation";
            }
            else if (testItem.IsTestCase)
            {
                itemKind = "Test Case";
            }
            else if (testItem is TestModuleData)
            {
                itemKind = "Test Module";
            }

            return(itemKind);
        }
Exemplo n.º 8
0
        private static string GetFullPath(TestItemData item)
        {
            // module isn't represented in the path
            if (item.Parent == null)
            {
                return(string.Empty);
            }

            string name = item.Metadata.Name;

            string parentName = GetFullPath(item.Parent);

            if (!string.IsNullOrEmpty(parentName))
            {
                name = parentName + '/' + name;
            }

            return(name);
        }
Exemplo n.º 9
0
        private string GetNestedTestName(TestItemData itemData)
        {
            string name            = null;
            var    currentItemData = itemData;

            while (currentItemData != null)
            {
                if (name == null)
                {
                    name = currentItemData.Metadata.Name;
                }
                else
                {
                    name = currentItemData.Metadata.Name + "." + name;
                }

                currentItemData = currentItemData.Parent;
            }

            return(name);
        }
        private void IncrementResultCounter(TestItemData testItemData, TestResult result)
        {
            int priority = testItemData.Metadata.Priority;

            RunStatistics statistics;

            if (!this.statisticsByPriority.TryGetValue(priority, out statistics))
            {
                this.statisticsByPriority[priority] = statistics = new RunStatistics();
            }

            switch (result)
            {
            case TestResult.Timeout:
                ++statistics.Timeouts;
                ++this.globalStatistics.Timeouts;
                break;

            case TestResult.Skipped:
                ++statistics.Skipped;
                ++this.globalStatistics.Skipped;
                break;

            case TestResult.Failed:
                ++statistics.Failures;
                ++this.globalStatistics.Failures;
                break;

            case TestResult.Passed:
                ++statistics.Passed;
                ++this.globalStatistics.Passed;
                break;

            case TestResult.Warning:
                ++statistics.Warnings;
                ++this.globalStatistics.Warnings;
                break;
            }
        }
        private void LogBeginTestItem(TestItemData itemData)
        {
            var testModuleData = itemData as TestModuleData;

            if (testModuleData != null)
            {
                this.currentLogWriter.BeginTestModule(testModuleData);
                return;
            }

            if (itemData.IsTestCase)
            {
                this.currentLogWriter.BeginTestCase(itemData);
                return;
            }

            if (itemData.IsVariation)
            {
                this.currentLogWriter.BeginVariation(itemData);
                return;
            }
        }
Exemplo n.º 12
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 void ExecuteNextChild()
        {
            do
            {
                this.currentContext.CurrentChildIndex++;
            }while (this.currentContext.CurrentChildIndex < this.currentContext.TestItem.Children.Count &&
                    !this.ShouldRun(this.currentContext.TestItemData.Children[this.currentContext.CurrentChildIndex]));

            if (this.currentContext.CurrentChildIndex < this.currentContext.TestItem.Children.Count)
            {
                var testItem     = this.currentContext.TestItem.Children[this.currentContext.CurrentChildIndex];
                var testItemData = this.currentContext.TestItemData.Children[this.currentContext.CurrentChildIndex];
                ExceptionUtilities.Assert(TestItemData.Matches(testItemData, testItem), "TestItemData and TestItem hierarchies should match exactly.");

                this.BeginExecution(
                    testItem,
                    testItemData);
            }
            else
            {
                this.EnterState(CurrentState.Terminating);
            }
        }
        private void BeginExecution(TestItem testItem, TestItemData itemData)
        {
            if (this.currentContext != null)
            {
                this.executionContextStack.Push(this.currentContext);
            }

            this.currentContext = new ExecutionContext()
            {
                TestItem          = testItem,
                TestItemData      = itemData,
                CurrentChildIndex = -1,
                CurrentState      = CurrentState.Initializing,
                CurrentResult     = TestResult.InProgress,
            };

            this.ReportItemStarting(TestResult.InProgress);
            this.LogBeginTestItem(itemData);

            var callback = this.CreateCallback();

            this.RunOnExecutionThread(() => testItem.InitAsync(callback));
        }
Exemplo n.º 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)
 {
     this.ForAll(i => i.EndVariation(variation, result, exception));
 }
Exemplo n.º 16
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)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
 }
Exemplo n.º 18
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
 }
Exemplo n.º 19
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();
        }
Exemplo n.º 20
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();
        }
Exemplo n.º 21
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.ForAll(i => i.BeginVariation(variation));
 }
Exemplo n.º 22
0
        private static string GetFullPath(TestItemData item)
        {
            // module isn't represented in the path
            if (item.Parent == null)
            {
                return string.Empty;
            }

            string name = item.Metadata.Name;

            string parentName = GetFullPath(item.Parent);
            if (!string.IsNullOrEmpty(parentName))
            {
                name = parentName + '/' + name;
            }

            return name;
        }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes a new instance of the TestItemStatusChangedEventArgs class.
 /// </summary>
 /// <param name="testItemData">The test item.</param>
 /// <param name="result">The result.</param>
 public TestItemStatusChangedEventArgs(TestItemData testItemData, TestResult result)
 {
     this.TestItemData = testItemData;
     this.TestResult   = result;
 }
Exemplo n.º 24
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)
 {
 }
Exemplo n.º 25
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)
 {
 }
Exemplo n.º 26
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.ForAll(i => i.BeginVariation(variation));
 }
Exemplo n.º 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));
 }
Exemplo n.º 28
0
        private string GetNestedTestName(TestItemData itemData)
        {
            string name = null;
            var currentItemData = itemData;
            while (currentItemData != null)
            {
                if (name == null)
                {
                    name = currentItemData.Metadata.Name;
                }
                else
                {
                    name = currentItemData.Metadata.Name + "." + name;
                }

                currentItemData = currentItemData.Parent;
            }

            return name;
        }
Exemplo n.º 29
0
        private void WriteTestItemDataDurationResult(TestItemData testItem)
        {
            var currentTestCaseWithTime = this.testItemTimeStack.Pop();
            ExceptionUtilities.Assert(testItem == currentTestCaseWithTime.Key, "Invalid test case on stack.");

            var elapsed = this.GetCurrentTime() - currentTestCaseWithTime.Value;

            bool writeOutInitTerminateTime = false;

            // Adding information on whether the information recorded is for a Variation - V, TestCase - TC, or TestModule - TM
            string type = "V";
            
            if (testItem.IsTestCase)
            {
                type = "TC";
                writeOutInitTerminateTime = true;
            }
            else if (testItem is TestModuleData)
            {
                type = "TM";
                writeOutInitTerminateTime = true;
            }

            // Getting TestCase Name, escaping the commas as it makes it more difficult
            // to import into excel
            var nestedName = this.GetNestedTestName(currentTestCaseWithTime.Key).Replace(',', ';');
            this.writer.WriteLine("{0}, {1}, {2}", type, nestedName, elapsed.TotalMilliseconds);

            // Add to running total of time if there is a parent
            if (testItem.Parent != null)
            {
                this.testItemRunningTotalLookup[testItem.Parent] = this.testItemRunningTotalLookup[testItem.Parent] + elapsed.TotalMilliseconds;
            }

            if (writeOutInitTerminateTime)
            {
                var runningTotal = this.testItemRunningTotalLookup[testItem];
                var startupTearDownTime = elapsed.TotalMilliseconds - runningTotal;

                // Write out the time that occurs between running the parent test and the child tests
                this.writer.WriteLine("{0}, {1}, {2}", type + "_I-T", nestedName, startupTearDownTime);
            }

            // Remove this item as its unneeded now
            this.testItemRunningTotalLookup.Remove(testItem);

            this.writer.Flush();
        }
Exemplo n.º 30
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.testItemRunningTotalLookup.Add(testCase, 0);
     this.testItemTimeStack.Push(new KeyValuePair <TestItemData, DateTimeOffset>(testCase, this.GetCurrentTime()));
 }
Exemplo n.º 31
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.testItemStack.Push(variation);
     this.writer.WriteStartElement("Variation");
     this.writer.WriteAttributeString("Pri", XmlConvert.ToString(variation.Metadata.Priority));
     this.writer.WriteAttributeString("Id", XmlConvert.ToString(variation.Metadata.Id));
     this.writer.WriteAttributeString("Desc", variation.Metadata.Description);
     this.writer.WriteString("\r\n");
     this.writer.Flush();
 }
Exemplo n.º 32
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.testItemTimeStack.Push(new KeyValuePair <TestItemData, DateTimeOffset>(variation, this.GetCurrentTime()));
 }
Exemplo n.º 33
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);
 }
Exemplo n.º 34
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
 }
Exemplo n.º 35
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.WriteBegin(variation);
 }
Exemplo n.º 36
0
 private void WriteBegin(TestItemData testItem)
 {
     this.WriteStatusText(LogLevel.Info, this.currentIndentLevel, string.Format(CultureInfo.InvariantCulture, "{0} '{1}' Starting", this.GetItemTypeName(testItem), testItem.Metadata.Description));
     this.Indent();
 }
Exemplo n.º 37
0
        /// <summary>
        /// Determines whether the specified <see cref="TestItemData"/> instance
        /// matches the specified <see cref="TestItem"/>. Matching, in this case,
        /// means that both objects have the same metadata, and all of their
        /// parents have the same metadata.
        /// </summary>
        /// <param name="testItemData">The <see cref="TestItemData"/> to compare with the <see cref="TestItem"/>.</param>
        /// <param name="other">The <see cref="TestItem"/> to consider.</param>
        /// <returns>
        /// true if this <see cref="TestItemData"/> matches the specified
        /// <see cref="TestItem"/>. Otherwise, false.
        /// </returns>
        public static bool Matches(TestItemData testItemData, TestItem other)
        {
            if (testItemData == null && other == null)
            {
                return true;
            }

            if ((testItemData == null) != (other == null))
            {
                return false;
            }

            if (testItemData.TestItemType != other.GetType())
            {
                return false;
            }

            if (!testItemData.Metadata.Equals(other.Metadata))
            {
                return false;
            }

            if (object.ReferenceEquals(testItemData.Parent, null) != (other.Parent == null))
            {
                return false;
            }

            if (testItemData.Parent != null)
            {
                return Matches(testItemData.Parent, other.Parent);
            }

            return true;
        }
Exemplo n.º 38
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.testItemRunningTotalLookup.Add(testCase, 0); 
     this.testItemTimeStack.Push(new KeyValuePair<TestItemData, DateTimeOffset>(testCase, this.GetCurrentTime()));
 }
Exemplo n.º 39
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.WriteResult(variation, result, exception);
 }
Exemplo n.º 40
0
        /// <summary>
        /// Determines whether the specified <see cref="TestItemData"/> is equal to this instance.
        /// </summary>
        /// <param name="other">The <see cref="TestItemData"/> to compare with this instance.</param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="TestItemData"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(TestItemData other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return false;
            }

            if (this.GetType() != other.GetType())
            {
                return false;
            }

            if (object.ReferenceEquals(this.Parent, null) != object.ReferenceEquals(other.Parent, null))
            {
                return false;
            }

            if (object.ReferenceEquals(this.Parent, null))
            {
                return this.Metadata.Equals(other.Metadata);
            }

            return this.Metadata.Equals(other.Metadata) &&
                this.Parent.Equals(other.Parent);
        }
Exemplo n.º 41
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestItemData"/> class.
 /// </summary>
 /// <param name="testItem">The test item whose data is exposed.</param>
 /// <param name="parent">The parent of this <see cref="TestItemData"/>, if it exists.</param>
 public TestItemData(TestItem testItem, TestItemData parent) :
     this(testItem)
 {
     this.Parent = parent;
 }
Exemplo n.º 42
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.WriteBegin(variation);
 }
Exemplo n.º 43
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.WriteBegin(testCase);
 }
Exemplo n.º 44
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.WriteResult(variation, result, exception);
 }
Exemplo n.º 45
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
 }
Exemplo n.º 46
0
 private void WriteBegin(TestItemData testItem)
 {
     this.WriteStatusText(LogLevel.Info, this.currentIndentLevel, string.Format(CultureInfo.InvariantCulture, "{0} '{1}' Starting", this.GetItemTypeName(testItem), testItem.Metadata.Description));
     this.Indent();
 }
Exemplo n.º 47
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)
 {
 }
Exemplo n.º 48
0
        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()));
        }
 /// <summary>
 /// Initializes a new instance of the TestItemStatusChangedEventArgs class.
 /// </summary>
 /// <param name="testItemData">The test item.</param>
 /// <param name="result">The result.</param>
 public TestItemStatusChangedEventArgs(TestItemData testItemData, TestResult result)
 {
     this.TestItemData = testItemData;
     this.TestResult = result;
 }
Exemplo n.º 50
0
        private string GetItemTypeName(TestItemData testItem)
        {
            string itemKind = string.Empty;
            if (testItem.IsVariation)
            {
                itemKind = "Variation";
            }
            else if (testItem.IsTestCase)
            {
                itemKind = "Test Case";
            }
            else if (testItem is TestModuleData)
            {
                itemKind = "Test Module";
            }

            return itemKind;
        }
Exemplo n.º 51
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.ForAll(i => i.BeginTestCase(testCase));
 }
Exemplo n.º 52
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.WriteBegin(testCase);
 }
Exemplo n.º 53
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));
 }
Exemplo n.º 54
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);
 }
Exemplo n.º 55
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.ForAll(i => i.BeginTestCase(testCase));
 }
Exemplo n.º 56
0
        /// <summary>
        /// Begins the test case.
        /// </summary>
        /// <param name="testCase">The test case.</param>
        public void BeginTestCase(TestItemData testCase)
        {
            this.testItemStack.Push(testCase);
            var metadata = testCase.Metadata;

            this.writer.WriteStartElement("TestCase");
            this.writer.WriteAttributeString("Name", metadata.Name);
            this.writer.WriteAttributeString("Desc", metadata.Description);
            this.writer.WriteString("\r\n");
            this.writer.Flush();
        }
Exemplo n.º 57
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));
 }
Exemplo n.º 58
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.testItemTimeStack.Push(new KeyValuePair<TestItemData, DateTimeOffset>(variation, this.GetCurrentTime()));
 }