Beispiel #1
0
        internal TestResult ProcessSingleTestNode(XmlNode theResultNode)
        {
            TestResult testResult = new TestResult();

            //Get the name and outcome of the test
            Regex match = new Regex("Environment='[A-Za-z]*'");
            Match environmentName = match.Match(theResultNode.InnerText);
            if (environmentName != Match.Empty)
            {
                string[] splitString = environmentName.ToString().Split('=');
                if (splitString.Length == 2)
                {
                    testResult.ExecutionEnvironment = splitString[1].Replace("'", "");
                }
            }
            testResult.TestName = theResultNode.Attributes["testName"].Value;
            testResult.setOutcome(theResultNode.Attributes["outcome"].Value);

            //Capture the end time and duration
            testResult.ExecutionCompletionDateTime = Convert.ToDateTime(theResultNode.Attributes["endTime"].Value);
            testResult.ExecutionDuration = TimeSpan.Parse(theResultNode.Attributes["duration"].Value);

            //Build the first part of the comment
            StringBuilder comment = new StringBuilder();
            comment.Append("\r\n");
            comment.Append("Test " + theResultNode.Attributes["outcome"].Value.ToUpper());
            comment.Append(" on " + theResultNode.Attributes["computerName"].Value);
            comment.Append(" at " + testResult.ExecutionCompletionDateTime.ToShortDateString() + " " + testResult.ExecutionCompletionDateTime.ToShortTimeString());
            comment.Append("\r\n");
            comment.Append("Duration: " + testResult.ExecutionDuration.Minutes + " min " + testResult.ExecutionDuration.Seconds + " sec");
            testResult.ExecutionComments = comment.ToString();
            testResult.ComputerName = theResultNode.Attributes["computerName"].Value;

            return testResult;
        }