/// <summary>
        /// Parses a TestCase log node.
        /// </summary>
        /// <param name="node">The TestCase Xml node to parse.</param>
        /// <param name="path">The QualifiedNameBuilder which hosts the current fully qualified path.</param>
        /// <param name="collection">The TestResultCollection which will host the result.</param>
        private static void ParseTestCaseLog(XmlNode node, QualifiedNameBuilder path, TestResultCollection collection)
        {
            // Temporarily push TestCase on TestSuite name builder to acquire the fully qualified name of the TestCase
            path.Push(node.Attributes[Xml.Name].Value);

            // Acquire result record of this TestCase
            TestResult result = collection[path.ToString()];
            if (result == null)
            {
                result = new TestResult(collection);
                collection[path.ToString()] = result;
            }

            // Reset path to original value
            path.Pop();

            XmlNode testingTime = node.SelectSingleNode(Xml.TestingTime);

            if (testingTime != null)
            {
                // Boost test testing time is listed in microseconds
                result.Duration = ulong.Parse(testingTime.InnerText, CultureInfo.InvariantCulture);
            }

            ParseTestCaseLogEntries(node.ChildNodes, result);
        }
示例#2
0
        public TestResultCollection processTrxFile(string fileName, bool publishFailures, bool PublishErrorInformation)
        {
            TestResultCollection resultCollection = new TestResultCollection();
            //Holds the contents of the trx file
            string trxFileContents;

            //Read out the contents of the trx file
            using (StreamReader trxReader = new StreamReader(fileName))
            {
                trxFileContents = trxReader.ReadToEnd();
                trxReader.Close();
            }

            //Load the file contents into an XML document object
            XmlDocument trxFileXml = new XmlDocument();
            trxFileXml.LoadXml(trxFileContents);

            //Configure the namespace manager
            XmlNamespaceManager xmlManager = new XmlNamespaceManager(trxFileXml.NameTable);
            xmlManager.AddNamespace("ns", "http://microsoft.com/schemas/VisualStudio/TeamTest/2006");

            //Get the list of unit test result nodes
            XmlNodeList resultNodes = trxFileXml.GetElementsByTagName("UnitTestResult");
            resultCollection.Append(ProcessResultsNode(resultNodes, publishFailures, PublishErrorInformation));

            //Now do the same for Manual tests
            resultNodes = trxFileXml.GetElementsByTagName("ManualTestResult");
            resultCollection.Append(ProcessResultsNode(resultNodes, publishFailures, PublishErrorInformation));

            XmlNodeList definitionNodes = trxFileXml.GetElementsByTagName("TestDefinitions");
            AddWorkItemsToResults(resultCollection, trxFileXml);
            AddExecutionUserToResults(resultCollection, trxFileXml);

            return resultCollection;
        }
示例#3
0
		public override void Visit (TestResultCollection node)
		{
			for (int i = 0; i < node.Count; i++) {
				var item = node [i];
				names.Push (item.Name);
				item.Accept (this);
				names.Pop ();
			}
		}
 public override void Visit(TestResultCollection node)
 {
     for (int i = 0; i < node.Count; i++)
     {
         var item = node [i];
         names.Push(item.Name);
         item.Accept(this);
         names.Pop();
     }
 }
示例#5
0
		static void WriteResults (TestResultCollection results)
		{
			if (xml) {
				var serializer = new XmlSerializer (typeof(TestResultCollection));
				serializer.Serialize (Console.Out, results);
				Console.WriteLine ();
			} else {
				ResultPrinter.Print (Console.Out, results);
			}
		}
示例#6
0
		public static void Print (TextWriter writer, TestResultCollection result)
		{
			writer.WriteLine ();
			writer.WriteLine ("Total: {0} tests, {1} passed, {2} errors.",
			                  result.Count, result.TotalSuccess, result.TotalErrors);
			writer.WriteLine ();

			var printer = new ResultPrinter (writer);
			printer.Visit (result);
		}
 private static void RegisterStandardOutputMessage(string output, TestResultCollection collection)
 {
     if (!string.IsNullOrEmpty(output))
     {
         foreach (TestResult result in collection)
         {
             result.LogEntries.Add(new LogEntryStandardOutputMessage(output));
         }
     }
 }
        public override void Parse(TestResultCollection collection)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(this.InputStream);

            if (doc.DocumentElement.Name == Xml.TestLog)
            {
                ParseTestUnitsLog(doc.DocumentElement.ChildNodes, new QualifiedNameBuilder(), collection);
            }
        }
        public override void Parse(TestResultCollection collection)
        {
            XPathDocument doc = new XPathDocument(this.InputStream);
            XPathNavigator nav = doc.CreateNavigator();

            // Move to document root node
            if ((nav.MoveToFirstChild()) && (nav.LocalName == Xml.TestResult))
            {
                ParseTestUnitsReport(nav, null, collection);
            }
        }
        public static void Print(TextWriter writer, TestResultCollection result)
        {
            writer.WriteLine();
            writer.WriteLine("Total: {0} tests, {1} passed, {2} errors.",
                             result.Count, result.TotalSuccess, result.TotalErrors);
            writer.WriteLine();

            var printer = new ResultPrinter(writer);

            printer.Visit(result);
        }
        /// <summary>
        /// Parses child TestUnit nodes.
        /// </summary>
        /// <param name="nav">The parent XPathNavigator which hosts TestUnit nodes.</param>
        /// <param name="parent">The parent TestSuite to which TestUnits are attached to.</param>
        /// <param name="collection">The TestResultCollection which will host the result.</param>
        private static void ParseTestUnitsReport(XPathNavigator nav, TestSuite parent, TestResultCollection collection)
        {
            foreach (XPathNavigator child in nav.SelectChildren(Xml.TestSuite, string.Empty))
            {
                ParseTestSuiteReport(child, parent, collection);
            }

            foreach (XPathNavigator child in nav.SelectChildren(Xml.TestCase, string.Empty))
            {
                ParseTestCaseReport(child, parent, collection);
            }
        }
示例#12
0
 static void WriteResults(TestResultCollection results)
 {
     if (xml)
     {
         var serializer = new XmlSerializer(typeof(TestResultCollection));
         serializer.Serialize(Console.Out, results);
         Console.WriteLine();
     }
     else
     {
         ResultPrinter.Print(Console.Out, results);
     }
 }
        /// <summary>
        /// Parses a general test result information from the provided node.
        /// </summary>
        /// <param name="node">The XPathNavigator pointing to a TestUnit node.</param>
        /// <param name="unit">The test unit for which the test results are related to.</param>
        /// <param name="collection">The TestResultCollection which will host the result.</param>
        private static TestResult ParseTestResult(XPathNavigator node, TestUnit unit, TestResultCollection collection)
        {
            TestResult result = new TestResult(collection);

            result.Unit = unit;
            result.Result = ParseResultType(node.GetAttribute(Xml.Result, string.Empty));

            result.AssertionsPassed = uint.Parse(node.GetAttribute(Xml.AssertionsPassed, string.Empty), CultureInfo.InvariantCulture);
            result.AssertionsFailed = uint.Parse(node.GetAttribute(Xml.AssertionsFailed, string.Empty), CultureInfo.InvariantCulture);
            result.ExpectedFailures = uint.Parse(node.GetAttribute(Xml.ExpectedFailures, string.Empty), CultureInfo.InvariantCulture);

            return result;
        }
        /// <summary>
        /// Generates TestResults based on Boost Test result output.
        /// </summary>
        /// <param name="testRun">The tests which have been executed in the prior test run.</param>
        /// <param name="start">The test execution start time.</param>
        /// <param name="end">The test execution end time.</param>
        /// <param name="settings">boost test adapter settings</param>
        /// <returns>A Visual Studio TestResult related to the executed test.</returns>
        private static IEnumerable <VSTestResult> GenerateTestResults(TestRun testRun, DateTimeOffset start, DateTimeOffset end, BoostTestAdapterSettings settings)
        {
            TestResultCollection results = new TestResultCollection();

            try
            {
                results.Parse(testRun.Arguments, settings);
            }
            catch (XmlException)
            {
                string text = ((File.Exists(testRun.Arguments.ReportFile)) ? File.ReadAllText(testRun.Arguments.ReportFile) : string.Empty);

                if (text.Trim().StartsWith(TestNotFound, StringComparison.Ordinal))
                {
                    return(testRun.Tests.Select(GenerateNotFoundResult));
                }
                else
                {
                    // Represent result parsing exception as a test fatal error
                    if (string.IsNullOrEmpty(text))
                    {
                        text = "Boost Test result file was not found or is empty.";
                    }

                    return(testRun.Tests.Select(test => {
                        Boost.Results.TestResult exception = new Boost.Results.TestResult(results);

                        exception.Unit = Boost.Test.TestUnit.FromFullyQualifiedName(test.FullyQualifiedName);

                        // NOTE Divide by 10 to compensate for duration calculation described in VSTestResult.AsVSTestResult(this Boost.Results.TestResult, VSTestCase)
                        exception.Duration = ((ulong)(end - start).Ticks) / 10;

                        exception.Result = TestResultType.Failed;
                        exception.LogEntries.Add(new Boost.Results.LogEntryTypes.LogEntryFatalError(text));

                        return GenerateResult(test, exception, start, end);
                    }));
                }
            }

            return(testRun.Tests.
                   Select(test =>
            {
                // Locate the test result associated to the current test
                Boost.Results.TestResult result = results[test.FullyQualifiedName];
                return (result == null) ? null : GenerateResult(test, result, start, end);
            }).
                   Where(result => (result != null)));
        }
示例#15
0
        private TestResultCollection AddExecutionUserToResults(TestResultCollection resultCollection, XmlDocument trxFileXml)
        {
            foreach (TestResult item in resultCollection)
            {
                string xpath = @"//ns:TestRun";
                XmlNamespaceManager xmlManager = new XmlNamespaceManager(trxFileXml.NameTable);
                xmlManager.AddNamespace("ns", "http://microsoft.com/schemas/VisualStudio/TeamTest/2006");

                XmlNode tmpnode = trxFileXml.SelectSingleNode(xpath, xmlManager);

                if (tmpnode != null)
                {
                    item.ExecutedBy = tmpnode.Attributes.GetNamedItem("runUser").Value;
                }
            }
            return resultCollection;
        }
        /// <summary>
        /// Processes the standard output and populates the relevant test result data of the referenced collection
        /// </summary>
        /// <param name="collection">test result collection where the leak information data will be inserted at</param>
        public override void Parse(TestResultCollection collection)
        {
            string strConsoleOutput = StreamToString(this.InputStream);

            //the below regex is intended to only to "detect" if any memory leaks are present. Note that any console output printed by the test generally appears before the memory leaks dump.
            Regex regexObj = new Regex(@"Detected\smemory\sleaks!\nDumping objects\s->\n(.*)Object dump complete.", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Multiline);
            Match outputMatch = regexObj.Match(strConsoleOutput);

            //leak has been detected
            if (outputMatch.Success)
            {
                RegisterMemoryLeak(outputMatch.Groups[1].Value, collection);
            }

            // Extract non-memory leak output
            string output = strConsoleOutput.Substring(0, ((outputMatch.Success) ? outputMatch.Index : strConsoleOutput.Length));
            RegisterStandardOutputMessage(output, collection);
        }
 public override void Parse(TestResultCollection collection)
 {
     // serge: now log output for dependent test cases supported, the have additional XML
     // element, that corrupts XML document structure
     using (XmlTextReader xtr = new XmlTextReader(this.InputStream, XmlNodeType.Element, null))
     {
         while (xtr.Read())
         {
             if (xtr.NodeType == XmlNodeType.Element && xtr.Name == Xml.TestLog)
             {
                 XmlDocument doc = new XmlDocument();
                 XmlElement elemTestLog = doc.CreateElement(Xml.TestLog);
                 elemTestLog.InnerXml = xtr.ReadInnerXml();
                 ParseTestUnitsLog(elemTestLog.ChildNodes, new QualifiedNameBuilder(), collection);
                 break;
             }
         }
     }
 }
        public override void Parse(TestResultCollection collection)
        {
            Utility.Code.Require(collection, "collection");

            string err = null;

            using (StreamReader reader = new StreamReader(this.InputStream))
            {
                err = reader.ReadToEnd();
            }

            if (!string.IsNullOrEmpty(err))
            {
                // Attach the stderr output to each TestCase result in the collection
                // since we cannot distinguish to which TestCase (in case multiple TestCases are registered)
                // the output is associated with.
                foreach (TestResult result in collection)
                {
                    // Consider the whole standard error contents as 1 entry.
                    result.LogEntries.Add(new LogEntryStandardErrorMessage(err));
                }
            }
        }
        /// <summary>
        /// Generates TestResults based on Boost Test result output.
        /// </summary>
        /// <param name="testRun">The tests which have been executed in the prior test run.</param>
        /// <param name="start">The test execution start time.</param>
        /// <param name="end">The test execution end time.</param>
        /// <param name="settings">boost test adapter settings</param>
        /// <returns>A Visual Studio TestResult related to the executed test.</returns>
        private static IEnumerable<VSTestResult> GenerateTestResults(TestRun testRun, DateTimeOffset start, DateTimeOffset end, BoostTestAdapterSettings settings)
        {
            TestResultCollection results = new TestResultCollection();

            try
            {
                results.Parse(testRun.Arguments, settings);
            }
            catch (XmlException)
            {
                string text = ((File.Exists(testRun.Arguments.ReportFile)) ? File.ReadAllText(testRun.Arguments.ReportFile) : string.Empty);

                if (text.Trim().StartsWith(TestNotFound, StringComparison.Ordinal))
                {
                    return testRun.Tests.Select(GenerateNotFoundResult);
                }
                else
                {
                    // Represent result parsing exception as a test fatal error
                    if (string.IsNullOrEmpty(text))
                    {
                        text = "Boost Test result file was not found or is empty.";
                    }

                    return testRun.Tests.Select(test => {
                        Boost.Results.TestResult exception = new Boost.Results.TestResult(results);

                        exception.Unit = Boost.Test.TestUnit.FromFullyQualifiedName(test.FullyQualifiedName);

                        // NOTE Divide by 10 to compensate for duration calculation described in VSTestResult.AsVSTestResult(this Boost.Results.TestResult, VSTestCase)
                        exception.Duration = ((ulong)(end - start).Ticks) / 10;

                        exception.Result = TestResultType.Failed;
                        exception.LogEntries.Add(new Boost.Results.LogEntryTypes.LogEntryFatalError(text));

                        return GenerateResult(test, exception, start, end);
                    });
                }
            }

            return testRun.Tests.
                Select(test =>
                {
                    // Locate the test result associated to the current test
                    Boost.Results.TestResult result = results[test.FullyQualifiedName];
                    return (result == null) ? null : GenerateResult(test, result, start, end);
                }).
                Where(result => (result != null));
        }
示例#20
0
 public ParsedData()
 {
     ResultLines = new TestResultCollection();
     outcomeNames = new List<string>();
     NCrunchCoverageData = new NCrunchCoverageDataCollection();
 }
 /// <summary>
 /// Parses child TestUnit nodes.
 /// </summary>
 /// <param name="nodes">The collection of Xml nodes which are valid TestUnit nodes.</param>
 /// <param name="path">The QualifiedNameBuilder which hosts the current fully qualified path.</param>
 /// <param name="collection">The TestResultCollection which will host the result.</param>
 private static void ParseTestUnitsLog(XmlNodeList nodes, QualifiedNameBuilder path, TestResultCollection collection)
 {
     foreach (XmlNode child in nodes)
     {
         if (child.NodeType == XmlNodeType.Element)
         {
             if (child.Name == Xml.TestSuite)
             {
                 ParseTestSuiteLog(child, path, collection);
             }
             else if (child.Name == Xml.TestCase)
             {
                 ParseTestCaseLog(child, path, collection);
             }
         }
     }
 }
        /// <summary>
        /// Parses a TestSuite log node.
        /// </summary>
        /// <param name="node">The TestSuite Xml node to parse.</param>
        /// <param name="path">The QualifiedNameBuilder which hosts the current fully qualified path.</param>
        /// <param name="collection">The TestResultCollection which will host the result.</param>
        private static void ParseTestSuiteLog(XmlNode node, QualifiedNameBuilder path, TestResultCollection collection)
        {
            path.Push(node.Attributes[Xml.Name].Value);

            ParseTestUnitsLog(node.ChildNodes, path, collection);

            path.Pop();
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="collection">The TestResultCollection which hosts all results.</param>
 /// <param name="types">The types to lookup</param>
 public TestCaseResultVisitor(TestResultCollection collection, IEnumerable<TestResultType> types)
 {
     this.Collection = collection;
     this.ResultTypes = types;
     this.Count = 0;
 }
        /// <summary>
        /// Generates TestResults based on Boost Test result output.
        /// </summary>
        /// <param name="testRun">The tests which have been executed in the prior test run.</param>
        /// <param name="start">The test execution start time.</param>
        /// <param name="end">The test execution end time.</param>
        /// <param name="settings">boost test adapter settings</param>
        /// <returns>A Visual Studio TestResult related to the executed test.</returns>
        private static IEnumerable<VSTestResult> GenerateTestResults(TestRun testRun, DateTimeOffset start, DateTimeOffset end, BoostTestAdapterSettings settings)
        {
            TestResultCollection results = new TestResultCollection();

            try
            {
                results.Parse(testRun.Arguments, settings);
            }
            catch (XmlException)
            {
                string text = File.ReadAllText(testRun.Arguments.ReportFile);

                if (text.Trim().StartsWith(TestNotFound, StringComparison.Ordinal))
                {
                    return testRun.Tests.Select(GenerateNotFoundResult);
                }
                else
                {
                    // Re-throw the exception
                    throw;
                }
            }

            return testRun.Tests.
                Select(test =>
                {
                    // Locate the test result associated to the current test
                    Boost.Results.TestResult result = results[test.FullyQualifiedName];

                    if (result != null)
                    {
                        // Convert the Boost.Test.Result data structure into an equivalent Visual Studio model
                        VSTestResult vsResult = result.AsVSTestResult(test);
                        vsResult.StartTime = start;
                        vsResult.EndTime = end;

                        return vsResult;
                    }

                    return null;
                }).
                Where(result => (result != null));
        }
示例#25
0
        /// <summary>
        /// Handles the result coming from vs test and store it in test results.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void TestResultHandler(object sender, TestResultEventArgs e)
        {
            ValidateArg.NotNull(sender, "sender");
            ValidateArg.NotNull(e, "e");

            var testResult = new ObjectModel.TestResult
            {
                DisplayName        = e.Result.DisplayName ?? e.Result.TestCase.FullyQualifiedName,
                FullyQualifiedName = e.Result.TestCase.FullyQualifiedName,
                ErrorStackTrace    = e.Result.ErrorStackTrace,
                ErrorMessage       = e.Result.ErrorMessage,
                TestResultId       = e.Result.TestCase.Id,
                Duration           = GetFormattedDurationString(e.Result.Duration),
                ResultOutcome      = e.Result.Outcome
            };

            var executionId       = GetExecutionId(e.Result);
            var parentExecutionId = GetParentExecutionId(e.Result);

            ResultCollectionDictionary.TryGetValue(e.Result.TestCase.Source, out var testResultCollection);
            if (testResultCollection == null)
            {
                testResultCollection = new TestResultCollection(e.Result.TestCase.Source)
                {
                    ResultList       = new List <ObjectModel.TestResult>(),
                    FailedResultList = new List <ObjectModel.TestResult>(),
                };
                ResultCollectionDictionary.TryAdd(e.Result.TestCase.Source, testResultCollection);
                TestRunDetails.ResultCollectionList.Add(testResultCollection);
            }

            TotalTests++;
            switch (e.Result.Outcome)
            {
            case TestOutcome.Failed:
                FailedTests++;
                break;

            case TestOutcome.Passed:
                PassedTests++;
                break;

            case TestOutcome.Skipped:
                SkippedTests++;
                break;

            default:
                break;
            }

            Results.TryAdd(executionId, testResult);

            // Check for parent execution id to store the test results in hierarchical way
            if (parentExecutionId == Guid.Empty)
            {
                if (e.Result.Outcome == TestOutcome.Failed)
                {
                    testResultCollection.FailedResultList.Add(testResult);
                }

                testResultCollection.ResultList.Add(testResult);
            }
            else
            {
                AddToParentResult(parentExecutionId, testResult);
            }
        }
示例#26
0
 private TestResultCollection ProcessResultsNode(XmlNodeList resultNodes, bool publishFailures, bool PublishErrorInformation)
 {
     TestResultCollection resultCollection = new TestResultCollection();
     foreach (XmlNode sourceNode in resultNodes)
     {
         //Send each result to the publish method
         TestResult singleResult = ProcessSingleTestNode(sourceNode);
         if (singleResult != null)
         {
             resultCollection.Add(singleResult);
         }
     }
     return resultCollection;
 }
 /// <summary>
 /// Registers any-and-all console output messages with all tests within the collection
 /// </summary>
 /// <param name="output">The console output</param>
 /// <param name="collection">The test collection in which to place console log entries</param>
 private void RegisterMessages(string output, TestResultCollection collection)
 {
     if (!string.IsNullOrEmpty(output))
     {
         // Attach the console output to each TestCase result in the collection
         // since we cannot distinguish to which TestCase (in case multiple TestCases are registered)
         // the output is associated with.
         foreach (TestResult result in collection)
         {
             // Consider the whole console contents as 1 entry.
             result.LogEntries.Add(CreateLogEntry(output));
         }
     }
 }
示例#28
0
 public ItemTestResult(DiskItem item, TestResultCollection results)
 {
     Item    = item;
     Results = results;
 }
示例#29
0
		public ItemTestResult(DiskItem item, TestResultCollection results)
		{
			Item = item;
			Results = results;
		}
示例#30
0
        private TestResultCollection AddWorkItemsToResults(TestResultCollection resultCollection, XmlDocument trxFileXml)
        {
            foreach (TestResult item in resultCollection)
            {
                string xpath = @"//ns:UnitTest[@name='" + item.TestName + "']/ns:Workitems/ns:Workitem";
                XmlNamespaceManager xmlManager = new XmlNamespaceManager(trxFileXml.NameTable);
                xmlManager.AddNamespace("ns", "http://microsoft.com/schemas/VisualStudio/TeamTest/2006");

                XmlNode tmpnode = trxFileXml.SelectSingleNode(xpath, xmlManager);
                // Get TFS Id
                if (tmpnode == null)
                {
                    xpath = @"//ns:ManualTest[@name='" + item.TestName + "']/ns:Workitems/ns:Workitem";
                    tmpnode = trxFileXml.SelectSingleNode(xpath, xmlManager);
                }

                if (tmpnode != null)
                {
                    item.TFSWorkItemId = Convert.ToInt32(tmpnode.InnerText.ToString());
                }

                // Get description
                if (tmpnode == null)
                {
                    xpath = @"//ns:UnitTest[@name='" + item.TestName + "']/ns:Description";
                    tmpnode = trxFileXml.SelectSingleNode(xpath, xmlManager);
                }

                if (tmpnode != null)
                {
                    item.Description = tmpnode.InnerText.ToString();
                }
            }
            return resultCollection;
        }
示例#31
0
 public void SetResult(TestResultCollection results)
 {
     root = new ResultWrapper(results);
     OnChangedEvent();
 }
 public abstract void Parse(TestResultCollection collection);
 public void SetUp()
 {
     this.TestResultCollection = new TestResultCollection();
 }
示例#34
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Exception errorCatch = null;
            try
            {
                TestResultCollection allTestResults = new TestResultCollection();
                TrxFileParser trxparser = new TrxFileParser();
                this.Enabled = false;

                if (chkLstTrxFiles.CheckedItems.Count > 0)
                {
                    Settings _settings = new Settings();
                    if (ddlProvider.Text.ToLower() == "mercury")
                    {
                        //resultWriter = MercuryResultWriter.Instance();
                    }
                    else
                    {
                       resultWriter = TFS2010ResultWriter.Instance(_currentProjectContext, cbxCreateTestRun.Checked);
                    }
                    if (resultWriter.Cancelled)
                    {
                        ErrorReportingForm ef = new ErrorReportingForm();
                        ef.txtErrorDetails.Text = "User cancelled";
                        ef.Show();
                    }
                    else
                    {
                        //Show the output form
                        resultsForm = new PublishResults();
                        resultsForm.txtOutput.Text = "";
                        resultsForm.btnOk.Click += new EventHandler(resutlsForm_btnOk_click);
                        resultsForm.Show();
                        //Publish each of the selected trx files
                        resultsForm.SetOutputText("Processing results file...Start");
                        for (int i = 0; i < chkLstTrxFiles.CheckedItems.Count; i++)
                        {
                            allTestResults.Append(trxparser.processTrxFile(txtResultsFolder.Text + @"\" + chkLstTrxFiles.CheckedItems[i].ToString(), publishFailures.Checked, publishErrorInfo.Checked));
                        }
                        resultsForm.SetOutputText("Processing results file...Done.");

                        foreach (TestResult item in allTestResults)
                        {
                            resultsForm.AddResult(resultWriter.UpdateTestResult(item, this.publishFailures.Checked, this.publishInconclusive.Checked, this.publishErrorInfo.Checked));
                        }
                        resultsForm.btnOk.Enabled = true;
                    }
                    this.btnOk.Enabled = false;
                    this.btnCancel.Text = "Close";
                }
            }
            catch (Exception ex)
            {
                errorCatch = ex;
                ErrorReportingForm ef = new ErrorReportingForm();
                ef.txtErrorDetails.Text = errorCatch.Message + errorCatch.StackTrace;
                ef.Show();
                resultsForm.Close();
                this.Close();
            }
            finally
            {
                if (resultWriter != null)
                {
                    resultWriter.Disconnect();
                }
            }
        }
        private void RegisterMemoryLeak(string leakInformation, TestResultCollection collection)
        {
            foreach (TestResult result in collection)
            {
                if (this.FailTestOnMemoryLeak)
                {
                    result.Result = TestResultType.Failed;
                }

                Regex regexLeakInformation = new Regex(@"(?:([\\:\w\rA-z.]*?)([\w\d.]*)\((\d{1,})\)\s:\s)?\{(\d{1,})\}[\w\s\d]*,\s(\d{1,})[\s\w.]*\n(.*?)(?=$|(?:[\\\w.:]*\(\d{1,}\)\s:\s)?\{\d{1,}\d)", RegexOptions.IgnoreCase | RegexOptions.Singleline);   //the old one wasRegex regexLeakInformation = new Regex(@"^(.*\\)(.*?)\((\d{1,})\).*?{(\d{1,})}.*?(\d{1,})\sbyte", RegexOptions.IgnoreCase | RegexOptions.Multiline);
                /*

                 The same regex works for when the complete file path along with the line number are reported in the console output such as in the below sample output

                 d:\hwa\dev\svn\boostunittestadapterdev\branches\tempbugfixing\sample\boostunittest\boostunittest2\adapterbugs.cpp(58) : {869} normal block at 0x00A88A58, 4 bytes long.
                    Data: <    > CD CD CD CD
                 d:\hwa\dev\svn\boostunittestadapterdev\branches\tempbugfixing\sample\boostunittest\boostunittest2\adapterbugs.cpp(55) : {868} normal block at 0x00A88788, 4 bytes long.
                    Data: <    > F5 01 00 00

                 and also when this information is not reported such as in the below sample output

                {869} normal block at 0x005E8998, 4 bytes long.
                 Data: <    > CD CD CD CD
                {868} normal block at 0x005E8848, 4 bytes long.
                 Data: <    > F5 01 00 00

                 */

                #region regexLeakInformation

                // (?:([\\:\w\rA-z.]*?)([\w\d.]*)\((\d{1,})\)\s:\s)?\{(\d{1,})\}[\w\s\d]*,\s(\d{1,})[\s\w.]*\n(.*?)(?=$|(?:[\\\w.:]*\(\d{1,}\)\s:\s)?\{\d{1,}\d)
                //
                // Options: Case insensitive; Exact spacing; Dot matches line breaks; ^$ don't match at line breaks; Numbered capture
                //
                // Match the regular expression below «(?:([\\:\w\rA-z.]*?)([\w\d.]*)\((\d{1,})\)\s:\s)?»
                //    Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
                //    Match the regex below and capture its match into backreference number 1 «([\\:\w\rA-z.]*?)»
                //       Match a single character present in the list below «[\\:\w\rA-z.]*?»
                //          Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
                //          The backslash character «\\»
                //          The literal character “:” «:»
                //          A “word character” (Unicode; any letter or ideograph, digit, connector punctuation) «\w»
                //          The carriage return character «\r»
                //          A character in the range between “A” and “z” (case insensitive) «A-z»
                //          The literal character “.” «.»
                //    Match the regex below and capture its match into backreference number 2 «([\w\d.]*)»
                //       Match a single character present in the list below «[\w\d.]*»
                //          Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
                //          A “word character” (Unicode; any letter or ideograph, digit, connector punctuation) «\w»
                //          A “digit” (0–9 in any Unicode script) «\d»
                //          The literal character “.” «.»
                //    Match the character “(” literally «\(»
                //    Match the regex below and capture its match into backreference number 3 «(\d{1,})»
                //       Match a single character that is a “digit” (0–9 in any Unicode script) «\d{1,}»
                //          Between one and unlimited times, as many times as possible, giving back as needed (greedy) «{1,}»
                //    Match the character “)” literally «\)»
                //    Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                //    Match the character “:” literally «:»
                //    Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                // Match the character “{” literally «\{»
                // Match the regex below and capture its match into backreference number 4 «(\d{1,})»
                //    Match a single character that is a “digit” (0–9 in any Unicode script) «\d{1,}»
                //       Between one and unlimited times, as many times as possible, giving back as needed (greedy) «{1,}»
                // Match the character “}” literally «\}»
                // Match a single character present in the list below «[\w\s\d]*»
                //    Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
                //    A “word character” (Unicode; any letter or ideograph, digit, connector punctuation) «\w»
                //    A “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                //    A “digit” (0–9 in any Unicode script) «\d»
                // Match the character “,” literally «,»
                // Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                // Match the regex below and capture its match into backreference number 5 «(\d{1,})»
                //    Match a single character that is a “digit” (0–9 in any Unicode script) «\d{1,}»
                //       Between one and unlimited times, as many times as possible, giving back as needed (greedy) «{1,}»
                // Match a single character present in the list below «[\s\w.]*»
                //    Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
                //    A “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                //    A “word character” (Unicode; any letter or ideograph, digit, connector punctuation) «\w»
                //    The literal character “.” «.»
                // Match the line feed character «\n»
                // Match the regex below and capture its match into backreference number 6 «(.*?)»
                //    Match any single character «.*?»
                //       Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
                // Assert that the regex below can be matched, starting at this position (positive lookahead) «(?=$|(?:[\\\w.:]*\(\d{1,}\)\s:\s)?\{\d{1,}\d)»
                //    Match this alternative (attempting the next alternative only if this one fails) «$»
                //       Assert position at the end of the string, or before the line break at the end of the string, if any (line feed) «$»
                //    Or match this alternative (the entire group fails if this one fails to match) «(?:[\\\w.:]*\(\d{1,}\)\s:\s)?\{\d{1,}\d»
                //       Match the regular expression below «(?:[\\\w.:]*\(\d{1,}\)\s:\s)?»
                //          Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
                //          Match a single character present in the list below «[\\\w.:]*»
                //             Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
                //             The backslash character «\\»
                //             A “word character” (Unicode; any letter or ideograph, digit, connector punctuation) «\w»
                //             A single character from the list “.:” «.:»
                //          Match the character “(” literally «\(»
                //          Match a single character that is a “digit” (0–9 in any Unicode script) «\d{1,}»
                //             Between one and unlimited times, as many times as possible, giving back as needed (greedy) «{1,}»
                //          Match the character “)” literally «\)»
                //          Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                //          Match the character “:” literally «:»
                //          Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, next line) «\s»
                //       Match the character “{” literally «\{»
                //       Match a single character that is a “digit” (0–9 in any Unicode script) «\d{1,}»
                //          Between one and unlimited times, as many times as possible, giving back as needed (greedy) «{1,}»
                //       Match a single character that is a “digit” (0–9 in any Unicode script) «\d»

                #endregion regexLeakInformation

                Match matchLeakInformation = regexLeakInformation.Match(leakInformation);
                while (matchLeakInformation.Success)
                {
                    LogEntryMemoryLeak leak = new LogEntryMemoryLeak();

                    result.LogEntries.Add(leak);

                    //Capturing group 1,2 and 3 will have the 'Success' property false in case the C++ new operator has not been replaced via the macro

                    // Temporary variable used to try and parse unsigned integer values;
                    uint value = 0;

                    if (matchLeakInformation.Groups[1].Success && matchLeakInformation.Groups[2].Success && matchLeakInformation.Groups[3].Success)
                    {
                        leak.LeakSourceFilePath = matchLeakInformation.Groups[1].Value;

                        leak.LeakSourceFileName = matchLeakInformation.Groups[2].Value;

                        if (uint.TryParse(matchLeakInformation.Groups[3].Value, out value))
                        {
                            leak.LeakLineNumber = value;
                        }

                        leak.LeakSourceFileAndLineNumberReportingActive = true;
                    }
                    else
                    {
                        leak.LeakSourceFileAndLineNumberReportingActive = false;
                    }

                    if (uint.TryParse(matchLeakInformation.Groups[4].Value, out value))
                    {
                        leak.LeakMemoryAllocationNumber = value;
                    }

                    if (uint.TryParse(matchLeakInformation.Groups[5].Value, out value))
                    {
                        leak.LeakSizeInBytes = value;
                    }

                    leak.LeakLeakedDataContents = matchLeakInformation.Groups[6].Value;

                    matchLeakInformation = matchLeakInformation.NextMatch();
                }
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="collection">The parent collection which hosts this TestResult.</param>
 public TestResult(TestResultCollection collection)
 {
     this.Collection = collection;
     this.LogEntries = new List<LogEntry>();
 }
 /// <summary>
 /// Parses a TestCase node.
 /// </summary>
 /// <param name="node">The XPathNavigator pointing to a TestCase node.</param>
 /// <param name="parent">The parent TestSuite to which TestUnits are attached to.</param>
 /// <param name="collection">The TestResultCollection which will host the result.</param>
 private static void ParseTestCaseReport(XPathNavigator node, TestSuite parent, TestResultCollection collection)
 {
     TestCase testCase = new TestCase(node.GetAttribute(Xml.Name, string.Empty), parent);
     collection[testCase] = ParseTestResult(node, testCase, collection);
 }