public override bool TryParse() { if (!base.TryParse()) { return(false); } // update the duration for the last step TestReport ownerTest = (TestReport)OwnerTest; ActivityReport lastActivity = ownerTest.LastActivity; if (lastActivity != null) { TimeSpan ts = StartTime - lastActivity.StartTime; lastActivity.DurationSeconds = (decimal)ts.TotalSeconds; } ownerTest.LastActivity = this; // activity extended data string parentDir = Path.GetDirectoryName(ownerTest.ReportFile); if (!string.IsNullOrWhiteSpace(Node.Data.Extension.BottomFilePath)) { string bottomFilePath = Path.Combine(parentDir, Node.Data.Extension.BottomFilePath); ActivityExtensionData = XmlReportUtilities.LoadXmlFileBySchemaType <ActivityExtData>(bottomFilePath); } // activity checkpoint extended data if (Node.Data.Extension.MergedSTCheckpointData != null && !string.IsNullOrWhiteSpace(Node.Data.Extension.MergedSTCheckpointData.BottomFilePath)) { string bottomFilePath = Path.Combine(parentDir, Node.Data.Extension.MergedSTCheckpointData.BottomFilePath); CheckpointData = XmlReportUtilities.LoadXmlFileBySchemaType <CheckpointExtData>(bottomFilePath); } // sub activities SubActivities.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // sub-activities ActivityReport subActivity = SubActivities.TryParseAndAdd(node, this.Node); if (subActivity != null) { AllActivitiesEnumerator.Add(subActivity); AllActivitiesEnumerator.Merge(subActivity.AllActivitiesEnumerator); continue; } } } return(true); }
public override bool TryParse() { if (!base.TryParse()) { return(false); } // update the duration for the last step TestReport ownerTest = (TestReport)OwnerTest; StepReport lastStep = ownerTest.LastStep; if (lastStep != null) { TimeSpan ts = StartTime - lastStep.StartTime; lastStep.DurationSeconds = (decimal)ts.TotalSeconds; } ownerTest.LastStep = this; // test object path, operation and operation data TestObjectExtType testObj = Node.Data.Extension.TestObject; if (testObj != null) { TestObjectOperation = testObj.Operation; TestObjectOperationData = testObj.OperationData; if (!string.IsNullOrWhiteSpace(TestObjectOperationData) && Node.Status != ReportStatus.Failed) { Name += " " + testObj.OperationData; } TestObjectPathObjects = testObj.Path; if (TestObjectPathObjects != null && TestObjectPathObjects.Count() > 0) { TestObjectPath = string.Empty; foreach (TestObjectPathObjectExtType pathObj in TestObjectPathObjects) { // sample of pathObjStr: Window("Notepad") string pathObjStr = string.Empty; if (!string.IsNullOrWhiteSpace(pathObj.Type)) { pathObjStr = pathObj.Type; } if (!string.IsNullOrWhiteSpace(pathObj.Name)) { if (string.IsNullOrWhiteSpace(pathObjStr)) { pathObjStr = pathObj.Name; } else { pathObjStr += string.Format(" (\"{0}\")", pathObj.Name); } } // sample of TestObjectPath: Window("Notepad").WinMenu("Menu") if (!string.IsNullOrWhiteSpace(pathObjStr)) { if (!string.IsNullOrWhiteSpace(TestObjectPath)) { TestObjectPath += "."; } TestObjectPath += pathObjStr; } } } } // smart identification SmartIdentification = Node.Data.Extension.SmartIdentificationInfo; // contexts and sub-steps SubSteps.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // sub-steps StepReport subStep = SubSteps.TryParseAndAdd(node, this.Node); if (subStep != null) { AllStepsEnumerator.Add(subStep); AllStepsEnumerator.Merge(subStep.AllStepsEnumerator); continue; } // contexts ContextReport context = Contexts.TryParseAndAdd(node, this.Node); if (context != null) { AllStepsEnumerator.Merge(context.AllStepsEnumerator); continue; } } } return(true); }
public override bool TryParse() { if (!base.TryParse()) { return(false); } // for the branch (case) report node, the next level node is "Step" type // case name and description is retrieved from the "Step" type node ReportNodeType[] childNodes = Node.ReportNode; if (childNodes == null || childNodes.Length == 0) { return(false); } ReportNodeType caseStepNode = childNodes[0]; if (caseStepNode.type.ToLower() != NodeType_Step) { return(false); } CaseName = caseStepNode.Data.Name; CaseDescription = caseStepNode.Data.Description; // groups, flows, branches, bcs Groups.Clear(); Flows.Clear(); Branches.Clear(); BusinessComponents.Clear(); RecoverySteps.Clear(); GeneralSteps.Clear(); childNodes = caseStepNode.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // business component BusinessComponentReport bc = BusinessComponents.TryParseAndAdd(node, this.Node); if (bc != null) { AllBCsEnumerator.Add(bc); continue; } // group GroupReport group = Groups.TryParseAndAdd(node, this.Node); if (group != null) { AllBCsEnumerator.Merge(group.AllBCsEnumerator); continue; } // flow FlowReport flow = Flows.TryParseAndAdd(node, this.Node); if (flow != null) { AllBCsEnumerator.Merge(flow.AllBCsEnumerator); continue; } // branch BranchReport branch = Branches.TryParseAndAdd(node, this.Node); if (branch != null) { AllBCsEnumerator.Merge(branch.AllBCsEnumerator); continue; } // recovery step RecoveryStepReport recovery = RecoverySteps.TryParseAndAdd(node, this.Node); if (recovery != null) { AllBCsEnumerator.Merge(recovery.AllBCsEnumerator); continue; } // general step GeneralStepReport generalStep = GeneralSteps.TryParseAndAdd(node, this.Node); if (generalStep != null) { AllBCsEnumerator.Merge(generalStep.AllBCsEnumerator); continue; } } } return(true); }