Ejemplo n.º 1
0
        /// <summary>
        /// Called when Test Case Start event is invoked
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">TestCaseStartEventArgs</param>
        private void EventsTestCaseStart(object sender, TestCaseStartEventArgs e)
        {
            if (EqtTrace.IsInfoEnabled)
            {
                EqtTrace.Info("Blame Collector : Test Case Start");
            }

            var blameTestObject = new BlameTestObject(e.TestElement);

            // Add guid to list of test sequence to maintain the order.
            this.testSequence.Add(blameTestObject.Id);

            // Add the test object to the dictionary.
            this.testObjectDictionary.Add(blameTestObject.Id, blameTestObject);

            // Increment test start count.
            this.testStartCount++;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads All test case from file
        /// </summary>
        /// <param name="filePath">The path of test sequence file</param>
        /// <returns>Test Case List</returns>
        public List <BlameTestObject> ReadTestSequence(string filePath)
        {
            ValidateArg.NotNull(filePath, nameof(filePath));

            if (!this.fileHelper.Exists(filePath))
            {
                throw new FileNotFoundException();
            }

            var testCaseList = new List <BlameTestObject>();

            try
            {
                // Reading test sequence
                var xmlDocument = new XmlDocument();
                using (var stream = this.fileHelper.GetStream(filePath, FileMode.Open))
                {
                    xmlDocument.Load(stream);
                }

                var root = xmlDocument.LastChild;
                foreach (XmlNode node in root)
                {
                    var testCase = new BlameTestObject
                    {
                        FullyQualifiedName =
                            node.Attributes[Constants.TestNameAttribute].Value,
                        Source      = node.Attributes[Constants.TestSourceAttribute].Value,
                        DisplayName = node.Attributes[Constants.TestDisplayNameAttribute].Value,
                        IsCompleted = node.Attributes[Constants.TestCompletedAttribute].Value == "True" ? true : false
                    };
                    testCaseList.Add(testCase);
                }
            }
            catch (XmlException xmlException)
            {
                EqtTrace.Warning("XmlReaderWriter : Exception ", xmlException);
            }

            return(testCaseList);
        }