public override bool TryParse() { if (!base.TryParse()) { return(false); } // update the duration for the last business component TestReport ownerTest = (TestReport)OwnerTest; BusinessComponentReport lastBC = ownerTest.LastBusinessComponent; if (lastBC != null) { TimeSpan ts = StartTime - lastBC.StartTime; lastBC.DurationSeconds = (decimal)ts.TotalSeconds; } ownerTest.LastBusinessComponent = this; // steps BCSteps.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // sub-steps BCStepReport step = BCSteps.TryParseAndAdd(node, this.Node); if (step != null) { AllBCStepsEnumerator.Add(step); AllBCStepsEnumerator.Merge(step.AllBCStepsEnumerator); continue; } } } return(true); }
public override bool TryParse() { if (!base.TryParse()) { return(false); } // context? IsContext = Node.type.ToLower() == NodeType_Context; // update the duration for the last business component step if (OwnerBusinessComponent != null && !IsContext) { BCStepReport lastStep = OwnerBusinessComponent.LastBCStep; if (lastStep != null) { TimeSpan ts = StartTime - lastStep.StartTime; lastStep.DurationSeconds = (decimal)ts.TotalSeconds; } OwnerBusinessComponent.LastBCStep = 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; } } } } // sub-steps SubBCSteps.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // sub-steps BCStepReport subStep = SubBCSteps.TryParseAndAdd(node, this.Node); if (subStep != null) { AllBCStepsEnumerator.Add(subStep); AllBCStepsEnumerator.Merge(subStep.AllBCStepsEnumerator); continue; } } } return(true); }