public override bool TryParse() { if (!base.TryParse()) { return(false); } // activities Activities.Clear(); ReportNodeType[] childNodes = Node.ReportNode; if (childNodes != null) { foreach (ReportNodeType node in childNodes) { // try to add as an activity report ActivityReport activity = Activities.TryParseAndAdd(node, this.Node); if (activity != null) { AllActivitiesEnumerator.Add(activity); AllActivitiesEnumerator.Merge(activity.AllActivitiesEnumerator); continue; } } // update duration for the last activity since it is the end of the iteration ActivityReport lastActivity = ((TestReport)OwnerTest).LastActivity; if (lastActivity != null) { TimeSpan ts = lastActivity.StartTime - StartTime; lastActivity.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; 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); }