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); } // iteration index Index = Node.Data.IndexSpecified ? Node.Data.Index : 0; if (Index <= 0) { OutputWriter.WriteLine(Properties.Resources.ErrMsg_Input_InvalidGUITestIterationIndex, Index.ToString()); return(false); } // actions Actions.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { ActionReport action = Actions.TryParseAndAdd(node, this.Node); if (action != null) { AllStepsEnumerator.Merge(action.AllStepsEnumerator); continue; } } } if (Actions.Length == 0) { // no action node is parsed successfully under the iteration node, it is not a valid GUI test Xml report return(false); } return(true); }