Beispiel #1
0
        public virtual bool TryParse()
        {
            if (Node == null)
            {
                return(false);
            }

            Name            = Node.Data.Name;
            Description     = Node.Data.Description;
            Status          = Node.Status;
            StartTime       = XmlReportUtilities.ToDateTime(Node.Data.StartTime, OwnerTest.TimeZone);
            DurationSeconds = Node.Data.DurationSpecified ? Node.Data.Duration : 0;

            InputParameters = Node.Data.InputParameters;
            if (InputParameters == null)
            {
                InputParameters = new ParameterType[0];
            }

            OutputParameters = Node.Data.OutputParameters;
            if (OutputParameters == null)
            {
                OutputParameters = new ParameterType[0];
            }

            AUTs = Node.Data.TestedApplications;
            if (AUTs == null)
            {
                AUTs = new TestedApplicationType[0];
            }

            if (Status == ReportStatus.Failed)
            {
                ErrorText = Node.Data.ErrorText;
                if (string.IsNullOrWhiteSpace(Node.Data.ErrorText))
                {
                    ErrorText = Description;
                }
                ErrorCode = Node.Data.ExitCodeSpecified ? Node.Data.ExitCode : 0;
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Attempts to parse the test report node.
        /// </summary>
        /// <returns><c>true</c> if the <see cref="Node"/> is parsed successfully; otherwise, <c>false</c>.</returns>
        public virtual bool TryParse()
        {
            // the first report node is treated as the test run node
            Node = ParseTestReportNode();
            if (Node == null)
            {
                return(false);
            }

            // test and report name
            TestName   = Node.Data.Name;
            ReportName = Root.GeneralInfo.ResultName;
            if (!string.IsNullOrWhiteSpace(TestName))
            {
                if (!string.IsNullOrWhiteSpace(ReportName))
                {
                    TestAndReportName = string.Format("{0} - {1}", TestName, ReportName);
                }
                else
                {
                    TestAndReportName = TestName;
                }
            }
            else
            {
                TestAndReportName = ReportName;
            }

            // testing tool name and version
            TestingToolName = Root.GeneralInfo.OrchestrationToolName;
            if (string.IsNullOrWhiteSpace(TestingToolName))
            {
                TestingToolName = Properties.Resources.TestingToolName_UFT;
            }
            TestingToolVersion     = Root.GeneralInfo.OrchestrationToolVersionStringLiteral;
            TestingToolNameVersion = TestingToolName;
            if (!string.IsNullOrWhiteSpace(TestingToolVersion))
            {
                TestingToolNameVersion = string.Format("{0} {1}", TestingToolName, TestingToolVersion);
            }

            // other fields
            TestRunStartTime    = XmlReportUtilities.ToDateTime(Root.GeneralInfo.RunStartTime, Root.GeneralInfo.Timezone);
            TimeZone            = Root.GeneralInfo.Timezone;
            HostName            = Node.Data.Environment.HostName;
            TestDurationSeconds = Node.Data.DurationSpecified ? Node.Data.Duration : 0;
            Locale          = Node.Data.Environment.Locale;
            LoginUser       = Node.Data.Environment.User;
            OSInfo          = Node.Data.Environment.OSInfo;
            CPUInfo         = Node.Data.Environment.CpuInfo;
            CPUCores        = Node.Data.Environment.NumberOfCoresSpecified ? Node.Data.Environment.NumberOfCores : 0;
            CPUInfoAndCores = string.Format("{0} x {1}", CPUCores, CPUInfo);
            TotalMemory     = string.Format("{0} {1}", Node.Data.Environment.TotalMemory, Properties.Resources.Prop_MemoryUnit);

            TestInputParameters = Node.Data.InputParameters;
            if (TestInputParameters == null)
            {
                TestInputParameters = new ParameterType[0];
            }

            TestOutputParameters = Node.Data.OutputParameters;
            if (TestOutputParameters == null)
            {
                TestOutputParameters = new ParameterType[0];
            }

            TestAUTs = Node.Data.TestedApplications;
            if (TestAUTs == null)
            {
                TestAUTs = new TestedApplicationType[0];
            }

            return(true);
        }