public override string CreateReport(ReportInfo RI, bool statusByGroupActivity, ObservableList <ActInputValue> DynamicParameters) { base.RI = RI; string runSetName = WorkSpace.Instance.RunsetExecutor.RunSetConfig.ItemName; string runGroupName = "GingerRunGroup"; string executionTime = RI.DateCreated; string environment = RI.ExecutionEnv; List <BusinessFlowReport> BizFlows = RI.BusinessFlows; int passCount = 0, failedCount = 0, blockedCount = 0, totalCount = 0; if (BizFlows.Count == 0) { return("There are no " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlows) + " to create report"); } string reportHeader = @"<?xml version=""1.0"" encoding=""UTF-8""?>"; string reportGroups = @" <groups> <group name=""" + runGroupName + @""">"; string reportClasses = ""; string BFNames = ""; foreach (BusinessFlowReport BFR in BizFlows) { string BFResults = ""; BusinessFlow BF = (BusinessFlow)BFR.GetBusinessFlow(); totalCount = totalCount + BF.Activities.Count; reportClasses = reportClasses + @" <class name=""" + BF.Name + @".Ginger Business Flow"">"; if (!statusByGroupActivity) { BFResults = CraeteActivitiesStatusXml(BF, ref passCount, ref failedCount, ref blockedCount); } else { BFResults = CraeteGroupActivitiesStatusXml(BF, ref passCount, ref failedCount, ref blockedCount); } reportClasses = reportClasses + BFResults + @" </class>"; BFNames = BFNames + @" <method signature=""" + General.ConvertInvalidXMLCharacters(BF.Name) + @""" name=""" + General.ConvertInvalidXMLCharacters(BF.Name) + @""" class=""" + General.ConvertInvalidXMLCharacters(BF.Name) + ".Ginger Business Flow" + @"""/>"; } reportHeader = reportHeader + @" <testng-results Runset=""" + runSetName + @""" ExecutionTime=""" + executionTime + @""" Environment=""" + environment + @""" blocked=""" + blockedCount + @""" failed=""" + failedCount + @""" total=""" + totalCount + @""" passed=""" + passCount + @""">"; if (DynamicParameters.Count > 0) { reportHeader = reportHeader + @" <dynamic-parameters>"; foreach (ActInputValue actInput in DynamicParameters) { reportHeader = reportHeader + @" <paramter name =""" + actInput.Param + @""" value=""" + actInput.ValueForDriver + @"""/>"; } reportHeader = reportHeader + @" </dynamic-parameters>"; } reportHeader = reportHeader + @" <suite name=""" + General.ConvertInvalidXMLCharacters(runSetName) + @""">"; reportGroups = reportGroups + BFNames + @" </group> </groups>"; string xml = ""; xml = xml + reportHeader + reportGroups + @" <test name=""GingerTest"">" + reportClasses; xml = xml + @" </test> </suite> </testng-results> "; return(xml); }
public ReportPage(ReportInfo RI, string Xaml) { InitializeComponent(); ReportInfo = RI; LoadReportData(Xaml); }