public override bool TryParse() { if (!base.TryParse()) { return(false); } // contexts and steps Contexts.Clear(); Steps.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // try to add as a step report StepReport step = Steps.TryParseAndAdd(node, this.Node); if (step != null) { AllStepsEnumerator.Add(step); AllStepsEnumerator.Merge(step.AllStepsEnumerator); continue; } // try to add as a context report ContextReport context = Contexts.TryParseAndAdd(node, this.Node); if (context != null) { AllStepsEnumerator.Merge(context.AllStepsEnumerator); continue; } // try to add as an action iteration ActionIterationReport actionIteration = ActionIterations.TryParseAndAdd(node, this.Node); if (actionIteration != null) { AllStepsEnumerator.Merge(actionIteration.AllStepsEnumerator); continue; } // try to add as a sub-action ActionReport subAction = SubActions.TryParseAndAdd(node, this.Node); if (subAction != null) { AllStepsEnumerator.Merge(subAction.AllStepsEnumerator); continue; } } // update duration for the last step since it is the end of the action StepReport lastStep = ((TestReport)OwnerTest).LastStep; if (lastStep != null) { TimeSpan ts = lastStep.StartTime - StartTime; lastStep.UpdateDuration(DurationSeconds - (decimal)ts.TotalSeconds); } } 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); }