Пример #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();
 }
Пример #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()));
        }
Пример #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
        /// <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();
        }
Пример #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)));
            }
        }
Пример #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);
        }
Пример #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);
        }
Пример #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;
            }
        }
Пример #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));
        }
Пример #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));
 }
Пример #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)
 {
 }
Пример #17
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
 }
Пример #18
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
 }
Пример #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();
        }
Пример #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();
        }
Пример #21
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.ForAll(i => i.BeginVariation(variation));
 }
Пример #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;
        }
Пример #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;
 }
Пример #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)
 {
 }
Пример #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)
 {
 }
Пример #26
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.ForAll(i => i.BeginVariation(variation));
 }
Пример #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
        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;
        }
Пример #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();
        }
Пример #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()));
 }
Пример #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();
 }
Пример #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()));
 }
Пример #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);
 }
Пример #34
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
 }
Пример #35
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.WriteBegin(variation);
 }
Пример #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();
 }
Пример #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;
        }
Пример #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()));
 }
Пример #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);
 }
Пример #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);
        }
Пример #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;
 }
Пример #42
0
 /// <summary>
 /// Begins the variation.
 /// </summary>
 /// <param name="variation">The variation.</param>
 public void BeginVariation(TestItemData variation)
 {
     this.WriteBegin(variation);
 }
Пример #43
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.WriteBegin(testCase);
 }
Пример #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);
 }
Пример #45
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
 }
Пример #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();
 }
Пример #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)
 {
 }
Пример #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;
 }
Пример #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;
        }
Пример #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));
 }
Пример #52
0
 /// <summary>
 /// Begins the test case.
 /// </summary>
 /// <param name="testCase">The test case.</param>
 public void BeginTestCase(TestItemData testCase)
 {
     this.WriteBegin(testCase);
 }
Пример #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));
 }
Пример #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);
 }
Пример #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));
 }
Пример #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();
        }
Пример #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));
 }
Пример #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()));
 }