// Move all report items from here !!!!!!!!!!!!!!!! public void GenerateRunSetOfflineReport() { try { HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); string exec_folder = GetRunSetLastExecutionLogFolderOffline(); string reportsResultFolder = string.Empty; reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(exec_folder), false, null, null, false, currentConf.HTMLReportConfigurationMaximalFolderSize); if (reportsResultFolder == string.Empty) { //TODO AppReporter.ToUser(eUserMsgKey.StaticWarnMessage, "Failed to generate the report for the '" + WorkSpace.Businessflow.Name + "' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ", please execute it fully first."); return; } else { foreach (string txt_file in System.IO.Directory.GetFiles(reportsResultFolder)) { string fileName = Path.GetFileName(txt_file); if (fileName.Contains(".html")) { Process.Start(reportsResultFolder); Process.Start(reportsResultFolder + "\\" + fileName); } } } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); } }
//Move to GingerRunnerLogger public void GenerateBusinessFlowOfflineReport(Context context, string reportsResultFolder, string RunsetName = null) { HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); string exec_folder = string.Empty; exec_folder = GenerateBusinessflowOfflineExecutionLogger(context, RunsetName); if (string.IsNullOrEmpty(exec_folder)) { Reporter.ToUser(eUserMsgKey.ExecutionsResultsProdIsNotOn); return; } reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(exec_folder), false, null, reportsResultFolder, false, currentConf.HTMLReportConfigurationMaximalFolderSize); if (reportsResultFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.AutomationTabExecResultsNotExists); return; } else { foreach (string txt_file in System.IO.Directory.GetFiles(reportsResultFolder)) { string fileName = System.IO.Path.GetFileName(txt_file); if (fileName.Contains(".html")) { Process.Start(reportsResultFolder); Process.Start(reportsResultFolder + "\\" + fileName); } } } }
private void ReportBtnClicked(object sender, RoutedEventArgs e) { HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (grdExecutionsHistory.CurrentItem == null) { Reporter.ToUser(eUserMsgKey.NoItemWasSelected); return; } if (((RunSetReport)grdExecutionsHistory.CurrentItem).DataRepMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB) { var selectedGuid = ((RunSetReport)grdExecutionsHistory.CurrentItem).GUID; WebReportGenerator webReporterRunner = new WebReportGenerator(); webReporterRunner.RunNewHtmlReport(string.Empty, selectedGuid); } else { string runSetFolder = executionLoggerHelper.GetLoggerDirectory(((RunSetReport)grdExecutionsHistory.CurrentItem).LogFolder); string reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, null, null, false, currentConf.HTMLReportConfigurationMaximalFolderSize); if (reportsResultFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.NoItemWasSelected); return; } else { Process.Start(reportsResultFolder); Process.Start(reportsResultFolder + "\\" + "GingerExecutionReport.html"); } } }
public void SetReportsConfigurations() { if ((this.ExecutionLoggerConfigurationSetList == null) || (this.ExecutionLoggerConfigurationSetList.Count == 0)) { this.ExecutionLoggerConfigurationSetList = new ObservableList <ExecutionLoggerConfiguration>(); ExecutionLoggerConfiguration ExecutionLoggerConfiguration = new ExecutionLoggerConfiguration(); ExecutionLoggerConfiguration.IsSelected = true; ExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled = true; ExecutionLoggerConfiguration.ExecutionLoggerConfigurationMaximalFolderSize = 250; ExecutionLoggerConfiguration.ExecutionLoggerConfigurationExecResultsFolder = @"~\ExecutionResults\"; ExecutionLoggerConfigurationSetList.Add(ExecutionLoggerConfiguration); } if ((this.HTMLReportsConfigurationSetList == null) || (this.HTMLReportsConfigurationSetList.Count == 0)) { this.HTMLReportsConfigurationSetList = new ObservableList <HTMLReportsConfiguration>(); HTMLReportsConfiguration HTMLReportsConfiguration = new HTMLReportsConfiguration(); HTMLReportsConfiguration.IsSelected = true; HTMLReportsConfiguration.HTMLReportsFolder = @"~\HTMLReports\"; HTMLReportsConfiguration.HTMLReportsAutomaticProdIsEnabled = false; HTMLReportsConfigurationSetList.Add(HTMLReportsConfiguration); } App.AutomateTabGingerRunner.ExecutionLogger.Configuration = this.ExecutionLoggerConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); }
private void ReportBtnClicked(object sender, RoutedEventArgs e) { HTMLReportsConfiguration currentConf = App.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (grdExecutionsHistory.CurrentItem == null) { Reporter.ToUser(eUserMsgKeys.NoItemWasSelected); return; } string runSetFolder = ExecutionLogger.GetLoggerDirectory(((RunSetReport)grdExecutionsHistory.CurrentItem).LogFolder); string reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, null, null, false, currentConf.HTMLReportConfigurationMaximalFolderSize); if (reportsResultFolder == string.Empty) { Reporter.ToUser(eUserMsgKeys.NoItemWasSelected); return; } else { Process.Start(reportsResultFolder); Process.Start(reportsResultFolder + "\\" + "GingerExecutionReport.html"); } }
// TODO: Make this function to just generate the report folder !!! public LiteDbRunSet RunNewHtmlReport(string reportResultsFolderPath = "", string runSetGuid = null, WebReportFilter openObject = null, bool shouldDisplayReport = true) { //Copy folder to reportResultsFolderPath or Execution logger string reportsResultFolder = string.Empty; if (!string.IsNullOrEmpty(reportResultsFolderPath)) { reportsResultFolder = reportResultsFolderPath; } else { HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); reportsResultFolder = Path.Combine(ExtensionMethods.GetReportDirectory(currentConf.HTMLReportsFolder), "Reports", "Ginger-Web-Client"); } try { string clientAppFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Reports", "Ginger-Web-Client"); Reporter.ToLog(eLogLevel.INFO, "Copying web report folder from: " + clientAppFolderPath); Reporter.ToLog(eLogLevel.INFO, "Copying web report folder to: " + reportsResultFolder); if (Directory.Exists(clientAppFolderPath)) { string rootFolder = Path.Combine(reportsResultFolder); if (Directory.Exists(rootFolder)) { IoHandler.Instance.TryFolderDelete(rootFolder); } IoHandler.Instance.CopyFolderRec(clientAppFolderPath, reportsResultFolder, true); } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Check WebReportFolder Error: " + ex.Message, ex); } //get exeution data and replace LiteDbRunSet lightDbRunSet = new LiteDbRunSet(); bool response = false; try { if (!Directory.Exists(reportsResultFolder)) { return(lightDbRunSet); } IoHandler.Instance.DeleteFoldersData(Path.Combine(reportsResultFolder, "assets", "Execution_Data")); IoHandler.Instance.DeleteFoldersData(Path.Combine(reportsResultFolder, "assets", "screenshots")); LiteDbManager dbManager = new LiteDbManager(new ExecutionLoggerHelper().GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder)); lightDbRunSet = dbManager.GetLatestExecutionRunsetData(runSetGuid); PopulateMissingFields(lightDbRunSet, reportsResultFolder); string json = Newtonsoft.Json.JsonConvert.SerializeObject(lightDbRunSet); response = RunClientApp(json, reportsResultFolder, openObject, shouldDisplayReport); } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "RunNewHtmlReport,error :" + ex.ToString()); } return(lightDbRunSet); }
private void Businessflow_ClickGenerateReport(object sender, RoutedEventArgs e) { if (CheckCurrentRunnerIsNotRuning()) { return; } BusinessFlow bf = (BusinessFlow)((RunnerItemPage)sender).ItemObject; if (mRunner.ExecutionLoggerManager.Configuration.SelectedDataRepositoryMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB) { GenerateBFReport(bf); return; } ExecutionLoggerConfiguration _selectedExecutionLoggerConfiguration = WorkSpace.Instance.Solution.LoggerConfigurations; HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null) { string reportpath = ((BusinessFlow)((RunnerItemPage)sender).ItemObject).ExecutionFullLogFolder; string reportsResultFolder = string.Empty; if (!string.IsNullOrEmpty(reportpath)) { reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(reportpath), false, null, currentConf.HTMLReportsFolder + Ginger.Run.ExecutionLoggerManager.defaultRunTabBFName + Ginger.Reports.GingerExecutionReport.ExtensionMethods.folderNameNormalazing(bf.Name)); } if (!_selectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled) { Reporter.ToUser(eUserMsgKey.ExecutionsResultsProdIsNotOn); return; } else if (reportsResultFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.ExecutionsResultsNotExists); return; } else { foreach (string txt_file in System.IO.Directory.GetFiles(reportsResultFolder)) { string fileName = System.IO.Path.GetFileName(txt_file); if (fileName.Contains(".html")) { Process.Start(reportsResultFolder); Process.Start(reportsResultFolder + "\\" + fileName); } } } } else { Context context = new Context(); context.BusinessFlow = bf; context.Runner = mRunner; context.Environment = mRunner.ProjEnvironment; mRunner.ExecutionLoggerManager.GenerateBusinessFlowOfflineReport(context, currentConf.HTMLReportsFolder + bf.Name, WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name); } }
public override void Execute(ReportInfo RI) { string reportsResultFolder = string.Empty; HTMLReportsConfiguration currentConf = App.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (App.RunsetExecutor.RunSetConfig.RunsetExecLoggerPopulated) { string runSetFolder = string.Empty; if (App.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null) { runSetFolder = App.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder; AutoLogProxy.UserOperationStart("Online Report"); } else { runSetFolder = ExecutionLogger.GetRunSetLastExecutionLogFolderOffline(); AutoLogProxy.UserOperationStart("Offline Report"); } if (!string.IsNullOrEmpty(selectedHTMLReportTemplateID.ToString())) { if ((isHTMLReportFolderNameUsed) && (HTMLReportFolderName != null) && (HTMLReportFolderName != string.Empty)) { ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(), HTMLReportFolderName + "\\" + System.IO.Path.GetFileName(runSetFolder), isHTMLReportPermanentFolderNameUsed, currentConf.HTMLReportConfigurationMaximalFolderSize); } else { ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(), null, isHTMLReportPermanentFolderNameUsed); } } else { reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, null, null, isHTMLReportPermanentFolderNameUsed); } } else { Errors = "In order to get HTML report, please, perform executions before"; Reporter.CloseGingerHelper(); Status = Ginger.Run.RunSetActions.RunSetActionBase.eRunSetActionStatus.Failed; return; } }
public void HTMLReportAttachment(string extraInformationCalculated, ref string emailReadyHtml, ref string reportsResultFolder, string runSetFolder, object Report, object conf) { EmailHtmlReportAttachment rReport = (EmailHtmlReportAttachment)Report; HTMLReportsConfiguration currentConf = (HTMLReportsConfiguration)conf; emailReadyHtml = emailReadyHtml.Replace("<!--WARNING-->", ""); ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); reportsResultFolder = ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == rReport.SelectedHTMLReportTemplateID)).FirstOrDefault(), extraInformationCalculated + System.IO.Path.DirectorySeparatorChar + System.IO.Path.GetFileName(runSetFolder), false, currentConf.HTMLReportConfigurationMaximalFolderSize); }
private void OpenHTMLReportsFolder(object sender, RoutedEventArgs e) { HTMLReportsConfiguration _selectedHTMLReportConfiguration = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (_selectedHTMLReportConfiguration != null) { string path = Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetReportDirectory(_selectedHTMLReportConfiguration.HTMLReportsFolder); if (System.IO.Directory.Exists(path)) { Process.Start(path); } } }
//[Timeout(60000)] public void GenrateLastExecutionHTMLReportTest() { string BusinessFlowReportFolder = GingerTestHelper.TestResources.GetTestResourcesFolder(@"Reports\AutomationTab_LastExecution\"); ReportInfo RI = new ReportInfo(BusinessFlowReportFolder); //Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(RI); string templatesFolder = (ExtensionMethods.getGingerEXEFileName() + @"Reports\GingerExecutionReport\").Replace("Ginger.exe", ""); HTMLReportConfiguration selectedHTMLReportConfiguration = HTMLReportConfiguration.SetHTMLReportConfigurationWithDefaultValues("DefaultTemplate", true); HTMLReportsConfiguration hTMLReportsConfiguration = new HTMLReportsConfiguration(); string hTMLOutputFolder = @"C:\HTMLReports\"; string report = Ginger.Reports.GingerExecutionReport.ExtensionMethods.NewFunctionCreateGingerExecutionReport(RI, false, selectedHTMLReportConfiguration, templatesFolder: templatesFolder, hTMLReportsConfiguration: hTMLReportsConfiguration, hTMLOutputFolder: hTMLOutputFolder); }
string jsonDumpFolder = @"c:\temp\Ginger\Dump\"; // !!!!!!!!!!!!!!!!!!!temp FIXME void GenerateReport(BusinessFlow businessFlow) // temp remove BF from param { string BusinessFlowReportFolder = jsonDumpFolder + "1 " + businessFlow.GetNameForFileName(); // !!!!!!!!!!!!!!!! temp remove ReportInfo RI = new ReportInfo(BusinessFlowReportFolder); //Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(RI); string templatesFolder = @"C:\Users\yaronwe\source\repos\Ginger\Ginger\Ginger\Reports\GingerExecutionReport\"; // !!!!!!!!!!!!!!!!!!!!!!! temp fix me HTMLReportConfiguration selectedHTMLReportConfiguration = HTMLReportConfiguration.SetHTMLReportConfigurationWithDefaultValues("DefaultTemplate", true); HTMLReportsConfiguration hTMLReportsConfiguration = new HTMLReportsConfiguration(); string hTMLOutputFolder = @"C:\Temp\Ginger\Report"; // !!!!!!!!!!!!!!!!!!!!!!! temp fix me Directory.Delete(hTMLOutputFolder, true); Directory.CreateDirectory(hTMLOutputFolder); string report = Ginger.Reports.GingerExecutionReport.ExtensionMethods.NewFunctionCreateGingerExecutionReport(RI, true, selectedHTMLReportConfiguration, templatesFolder: templatesFolder, hTMLReportsConfiguration: hTMLReportsConfiguration, hTMLOutputFolder: hTMLOutputFolder); //ExecutionLoggerConfiguration executionLoggerConfiguration = new ExecutionLoggerConfiguration(); //// HTMLReportsConfiguration currentConf = WorkSpace.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); ////get logger files //string exec_folder = @"c:\temp\hh"; // Ginger.Run.ExecutionLogger.GetLoggerDirectory(executionLoggerConfiguration.ExecutionLoggerConfigurationExecResultsFolder + "\\" + Ginger.Run.ExecutionLogger.defaultAutomationTabLogName);string templatesFolder = @"C:\Users\yaronwe\source\repos\Ginger\Ginger\Ginger\Reports\GingerExecutionReport\"; //string templatesFolder = @"C:\Users\yaronwe\source\repos\Ginger\Ginger\Ginger\Reports\GingerExecutionReport\"; ////create the report //HTMLReportConfiguration hTMLReportConfiguration = new HTMLReportConfiguration("DefaultTemplate", true); //string reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.NewFunctionCreateGingerExecutionReport(new ReportInfo(exec_folder), true, hTMLReportConfiguration, templatesFolder, false, 100000); //if (reportsResultFolder == string.Empty) //{ // Reporter.ToUser(eUserMsgKey.AutomationTabExecResultsNotExists); //} //else //{ // foreach (string txt_file in System.IO.Directory.GetFiles(reportsResultFolder)) // { // string fileName = Path.GetFileName(txt_file); // if (fileName.Contains(".html")) // { // System.Diagnostics.Process.Start(reportsResultFolder); // System.Diagnostics.Process.Start(reportsResultFolder + "\\" + fileName); // } // } //} }
public void CreateGingerExecutionReportAutomaticly() { HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if ((mSelectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled) && (Runners != null) && (Runners.Count > 0)) { if (mSelectedExecutionLoggerConfiguration.ExecutionLoggerHTMLReportsAutomaticProdIsEnabled) { string runSetReportName; if (!string.IsNullOrEmpty(RunSetConfig.Name)) { runSetReportName = RunSetConfig.Name; } else { runSetReportName = ExecutionLoggerManager.defaultRunTabLogName; } string exec_folder = new ExecutionLoggerHelper().GetLoggerDirectory(Path.Combine(mSelectedExecutionLoggerConfiguration.CalculatedLoggerFolder, runSetReportName + "_" + Runners[0].Executor.ExecutionLoggerManager.CurrentExecutionDateTime.ToString("MMddyyyy_HHmmssfff"))); } } }
public void HTMLReportAttachment(string extraInformationCalculated, ref string emailReadyHtml, ref string reportsResultFolder, string runSetFolder, object Report, object conf) { EmailHtmlReportAttachment rReport = (EmailHtmlReportAttachment)Report; HTMLReportsConfiguration currentConf = (HTMLReportsConfiguration)conf; if (!HTMLReportAttachmentConfigurationPage.HasWritePermission(extraInformationCalculated)) { emailReadyHtml = emailReadyHtml.Replace("<!--WARNING-->", "<b>Full report attachment failed, </b>" + "Error: User '" + WindowsIdentity.GetCurrent().Name.ToString() + "' have no write permission on provided alternative folder - " + extraInformationCalculated + ". Attachment in it not saved."); } else { emailReadyHtml = emailReadyHtml.Replace("<!--WARNING-->", ""); ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == rReport.SelectedHTMLReportTemplateID)).FirstOrDefault(), extraInformationCalculated + "\\" + System.IO.Path.GetFileName(runSetFolder), false, currentConf.HTMLReportConfigurationMaximalFolderSize); } }
private void ProduceLiteDBReportFolder(HTMLReportsConfiguration currentConf) { string reportsResultFolder; WebReportGenerator webReporterRunner = new WebReportGenerator(); string reportName = WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name; if (isHTMLReportFolderNameUsed && !String.IsNullOrEmpty(HTMLReportFolderName)) { reportsResultFolder = Path.Combine(HTMLReportFolderName, "Reports", "Ginger-Web-Client"); } else { reportsResultFolder = Path.Combine(Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetReportDirectory(currentConf.HTMLReportsFolder), "Reports", "Ginger-Web-Client"); } if (!String.IsNullOrEmpty(reportsResultFolder)) { webReporterRunner.RunNewHtmlReport(null, null, true); } string clientAppFolderPath = Path.Combine(WorkSpace.Instance.LocalUserApplicationDataFolderPath, "Reports", "Ginger-Web-Client"); if (isHTMLReportPermanentFolderNameUsed) { if (!Directory.Exists(reportsResultFolder)) { IoHandler.Instance.CopyFolderRec(clientAppFolderPath, reportsResultFolder, true); } else { webReporterRunner.DeleteFoldersData(Path.Combine(reportsResultFolder, "assets", "Execution_Data")); webReporterRunner.DeleteFoldersData(Path.Combine(reportsResultFolder, "assets", "screenshots")); IoHandler.Instance.CopyFolderRec(Path.Combine(clientAppFolderPath, "assets", "Execution_Data"), Path.Combine(reportsResultFolder, "assets", "Execution_Data"), true); IoHandler.Instance.CopyFolderRec(Path.Combine(clientAppFolderPath, "assets", "screenshots"), Path.Combine(reportsResultFolder, "assets", "screenshots"), true); } } else { IoHandler.Instance.CopyFolderRec(clientAppFolderPath, $"{reportsResultFolder}_{reportName}_{DateTime.UtcNow.ToString("yyyymmddhhmmss")}", true); } }
public void CreateGingerExecutionReportAutomaticly() { HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); mSelectedExecutionLoggerConfiguration = WorkSpace.Instance.Solution.ExecutionLoggerConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if ((mSelectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled) && (Runners != null) && (Runners.Count > 0)) { if (mSelectedExecutionLoggerConfiguration.ExecutionLoggerHTMLReportsAutomaticProdIsEnabled) { string runSetReportName; if ((RunSetConfig.Name != null) && (RunSetConfig.Name != string.Empty)) { runSetReportName = RunSetConfig.Name; } else { runSetReportName = ExecutionLogger.defaultRunTabLogName; } string exec_folder = ExecutionLogger.GetLoggerDirectory(mSelectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationExecResultsFolder + "\\" + runSetReportName + "_" + Runners[0].ExecutionLogger.CurrentExecutionDateTime.ToString("MMddyyyy_HHmmss")); } } }
public void SetReportsConfigurations() { try { if (Solution.LoggerConfigurations == null || Solution.LoggerConfigurations.ExecutionLoggerConfigurationExecResultsFolder == null) { Solution.LoggerConfigurations = new ExecutionLoggerConfiguration(); Solution.LoggerConfigurations.IsSelected = true; Solution.LoggerConfigurations.ExecutionLoggerConfigurationIsEnabled = true; Solution.LoggerConfigurations.ExecutionLoggerConfigurationMaximalFolderSize = 250; Solution.LoggerConfigurations.ExecutionLoggerConfigurationExecResultsFolder = SolutionRepository.cSolutionRootFolderSign + "ExecutionResults"; } if ((Solution.HTMLReportsConfigurationSetList == null) || (Solution.HTMLReportsConfigurationSetList.Count == 0)) { Solution.HTMLReportsConfigurationSetList = new ObservableList <HTMLReportsConfiguration>(); HTMLReportsConfiguration HTMLReportsConfiguration = new HTMLReportsConfiguration(); HTMLReportsConfiguration.IsSelected = true; HTMLReportsConfiguration.HTMLReportTemplatesSeq = 1; HTMLReportsConfiguration.HTMLReportsFolder = SolutionRepository.cSolutionRootFolderSign + "HTMLReports"; HTMLReportsConfiguration.HTMLReportsAutomaticProdIsEnabled = false; Solution.HTMLReportsConfigurationSetList.Add(HTMLReportsConfiguration); } Solution.LoggerConfigurations.CalculatedLoggerFolder = Solution.LoggerConfigurations.ExecutionLoggerConfigurationExecResultsFolder; Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetSolutionHTMLReportConfigurations(); ExecutionLoggerConfiguration executionLoggerConfiguration = Solution.LoggerConfigurations; // !!!!!!!!!!!!! FIXME // ExecutionLogger executionLogger = App.AutomateTabGingerRunner.ExecutionLogger; // executionLogger.Configuration = executionLoggerConfiguration; } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void SetReportsConfigurations() { try { if ((this.ExecutionLoggerConfigurationSetList == null) || (this.ExecutionLoggerConfigurationSetList.Count == 0)) { this.ExecutionLoggerConfigurationSetList = new ObservableList <ExecutionLoggerConfiguration>(); ExecutionLoggerConfiguration ExecutionLoggerConfiguration = new ExecutionLoggerConfiguration(); ExecutionLoggerConfiguration.IsSelected = true; ExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled = true; ExecutionLoggerConfiguration.ExecutionLoggerConfigurationMaximalFolderSize = 250; ExecutionLoggerConfiguration.ExecutionLoggerConfigurationExecResultsFolder = @"~\ExecutionResults\"; ExecutionLoggerConfigurationSetList.Add(ExecutionLoggerConfiguration); } if ((this.HTMLReportsConfigurationSetList == null) || (this.HTMLReportsConfigurationSetList.Count == 0)) { this.HTMLReportsConfigurationSetList = new ObservableList <HTMLReportsConfiguration>(); HTMLReportsConfiguration HTMLReportsConfiguration = new HTMLReportsConfiguration(); HTMLReportsConfiguration.IsSelected = true; HTMLReportsConfiguration.HTMLReportTemplatesSeq = 1; HTMLReportsConfiguration.HTMLReportsFolder = @"~\HTMLReports\"; HTMLReportsConfiguration.HTMLReportsAutomaticProdIsEnabled = false; HTMLReportsConfigurationSetList.Add(HTMLReportsConfiguration); } Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetSolutionHTMLReportConfigurations(); ExecutionLoggerConfiguration executionLoggerConfiguration = this.ExecutionLoggerConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); // !!!!!!!!!!!!! FIXME // ExecutionLogger executionLogger = App.AutomateTabGingerRunner.ExecutionLogger; // executionLogger.Configuration = executionLoggerConfiguration; } catch (Exception e) { } }
private void ProduceLiteDBReportFolder(HTMLReportsConfiguration currentConf) { string reportsResultFolder; WebReportGenerator webReporterRunner = new WebReportGenerator(); string reportName = WorkSpace.Instance.RunsetExecutor.RunSetConfig.Name; if (isHTMLReportFolderNameUsed && !String.IsNullOrEmpty(HTMLReportFolderName)) { reportsResultFolder = Path.Combine(HTMLReportFolderName, "Reports"); } else { reportsResultFolder = Path.Combine(Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetReportDirectory(currentConf.HTMLReportsFolder), "Reports"); } if (isHTMLReportPermanentFolderNameUsed) { webReporterRunner.RunNewHtmlReport(Path.Combine(reportsResultFolder, "Ginger-Web-Client"), null, null, false); } else { webReporterRunner.RunNewHtmlReport(Path.Combine(reportsResultFolder, $"{reportName}_{DateTime.UtcNow.ToString("yyyymmddhhmmssfff")}"), null, null, false); } }
public void CreateGingerExecutionReportAutomaticly() { HTMLReportsConfiguration currentConf = App.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); _selectedExecutionLoggerConfiguration = App.UserProfile.Solution.ExecutionLoggerConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if ((_selectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled) && (Runners != null) && (Runners.Count > 0)) { if (_selectedExecutionLoggerConfiguration.ExecutionLoggerHTMLReportsAutomaticProdIsEnabled) { string runSetReportName; if ((RunSetConfig.Name != null) && (RunSetConfig.Name != string.Empty)) { runSetReportName = RunSetConfig.Name; } else { runSetReportName = ExecutionLogger.defaultRunTabLogName; } string exec_folder = ExecutionLogger.GetLoggerDirectory(_selectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationExecResultsFolder + "\\" + runSetReportName + "_" + Runners[0].ExecutionLogger.CurrentExecutionDateTime.ToString("MMddyyyy_HHmmss")); string reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(exec_folder), false, null, null, false, currentConf.HTMLReportConfigurationMaximalFolderSize); } } }
/// <summary> /// Create summary json of the execution /// </summary> /// <param name="fileName"></param> public void CreateExecutionHTMLReport(string fileName) { WorkSpace.Instance.RunsetExecutor.CreateGingerExecutionReportAutomaticly(); HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); HTMLReportConfiguration htmlRep = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>().Where(x => (x.IsSelected == true)).FirstOrDefault(); //if (grdExecutionsHistory.CurrentItem == null) //{ // Reporter.ToUser(eUserMsgKey.NoItemWasSelected); // return; //} // string runSetFolder = ExecutionLogger.GetLoggerDirectory(((RunSetReport)grdExecutionsHistory.CurrentItem).LogFolder); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! temp string runSetFolder = @"C:\Users\yaronwe\source\repos\Ginger\Ginger\GingerCoreNETUnitTest\bin\Debug\netcoreapp2.2\TestResources\Solutions\CLI\ExecutionResults\Default Run Set_04082019_115742"; string reportsResultFolder = ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, htmlRep, null, false, currentConf.HTMLReportConfigurationMaximalFolderSize); if (reportsResultFolder == string.Empty) { Reporter.ToUser(eUserMsgKey.NoItemWasSelected); return; } else { Process.Start(reportsResultFolder); Process.Start(reportsResultFolder + "\\" + "GingerExecutionReport.html"); } // System.IO.File.WriteAllText(fileName, s); // ExtensionMethods.CreateGingerExecutionReport() }
private async void Init() { try { xProcessingIcon.Visibility = Visibility.Visible; if (SourceControlIntegration.BusyInProcessWhileDownloading) { Reporter.ToUser(eUserMsgKeys.StaticInfoMessage, "Please wait for current process to end."); return; } SourceControlIntegration.BusyInProcessWhileDownloading = true; await Task.Run(() => { //set paths to ignore: List <string> pathsToIgnore = new List <string>(); pathsToIgnore.Add("PrevVersions"); pathsToIgnore.Add("RecentlyUsed.dat"); pathsToIgnore.Add("AutoSave"); pathsToIgnore.Add("Recover"); if (App.UserProfile.Solution != null && App.UserProfile.Solution.ExecutionLoggerConfigurationSetList != null && App.UserProfile.Solution.ExecutionLoggerConfigurationSetList.Count > 0) { pathsToIgnore.Add(Ginger.Run.ExecutionLogger.GetLoggerDirectory(App.UserProfile.Solution.ExecutionLoggerConfigurationSetList[0].ExecutionLoggerConfigurationExecResultsFolder)); } HTMLReportsConfiguration reportConfig = App.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (reportConfig != null) { pathsToIgnore.Add(Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetReportDirectory(reportConfig.HTMLReportsFolder)); } mFiles = SourceControlIntegration.GetPathFilesStatus(App.UserProfile.Solution.SourceControl, mPath, pathsToIgnore); //set items name and type Parallel.ForEach(mFiles, SCFI => { try { if (SCFI.Path.ToUpper().Contains(".GINGER.") && SCFI.Path.ToUpper().Contains(".XML")) { NewRepositorySerializer newRepositorySerializer = new NewRepositorySerializer(); //unserialize the item RepositoryItemBase item = newRepositorySerializer.DeserializeFromFile(SCFI.Path); SCFI.Name = item.ItemName; } else { SCFI.Name = SCFI.Path.Substring(SCFI.Path.LastIndexOf('\\') + 1); } } catch (Exception ex) { if (SCFI.Path.Contains('\\') && (SCFI.Path.LastIndexOf('\\') + 1 < SCFI.Path.Length - 1)) { SCFI.Name = SCFI.Path.Substring(SCFI.Path.LastIndexOf('\\') + 1); } Reporter.ToLog(eAppReporterLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex); } if (string.IsNullOrEmpty(SCFI.Path)) { SCFI.FileType = ""; } else if (SCFI.Path.ToUpper().Contains("AGENTS")) { SCFI.FileType = "Agent"; } else if (SCFI.Path.ToUpper().Contains("BUSINESSFLOWS")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); } else if (SCFI.Path.ToUpper().Contains("DOCUMENTS")) { SCFI.FileType = "Document"; } else if (SCFI.Path.ToUpper().Contains("ENVIRONMENTS")) { SCFI.FileType = "Environment"; } else if (SCFI.Path.ToUpper().Contains("EXECUTIONRESULTS")) { SCFI.FileType = "Execution Result"; } else if (SCFI.Path.ToUpper().Contains("RUNSET")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.RunSet); } else if (SCFI.Path.ToUpper().Contains("ACTIONS")) { SCFI.FileType = "Action"; } else if (SCFI.Path.ToUpper().Contains("ACTIVITIESGROUPS")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.ActivitiesGroup); } else if (SCFI.Path.ToUpper().Contains("ACTIVITIES")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.Activity); } else if (SCFI.Path.ToUpper().Contains("VARIABLES")) { SCFI.FileType = GingerDicser.GetTermResValue(eTermResKey.Variable); } else if (SCFI.Path.ToUpper().Contains("REPORTTEMPLATE")) { SCFI.FileType = "Report Template"; } else if (SCFI.Path.Contains("ApplicationAPIModel")) { SCFI.FileType = "Application API Model"; } else if (SCFI.Path.Contains("GlobalAppModelParameter")) { SCFI.FileType = "Global Applications Model Parameter"; } }); }); CheckInFilesGrid.DataSourceList = mFiles; } finally { xProcessingIcon.Visibility = Visibility.Collapsed; SourceControlIntegration.BusyInProcessWhileDownloading = false; } }
public override void Execute(ReportInfo RI) { string reportsResultFolder = string.Empty; HTMLReportsConfiguration currentConf = WorkSpace.Instance.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault(); if (WorkSpace.Instance.Solution.LoggerConfigurations.SelectedDataRepositoryMethod == ExecutionLoggerConfiguration.DataRepositoryMethod.LiteDB) { ProduceLiteDBReportFolder(currentConf); return; } if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.RunsetExecLoggerPopulated) { string runSetFolder = string.Empty; if (WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null) { runSetFolder = WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder; } else { GingerRunner gr = new GingerRunner(); runSetFolder = gr.ExecutionLoggerManager.GetRunSetLastExecutionLogFolderOffline(); } string currentHTMLFolderName = string.Empty; if (isHTMLReportFolderNameUsed && !String.IsNullOrEmpty(HTMLReportFolderName)) { if (!isHTMLReportPermanentFolderNameUsed) { currentHTMLFolderName = Path.Combine(HTMLReportFolderNameCalculated, System.IO.Path.GetFileName(runSetFolder)); } else { currentHTMLFolderName = HTMLReportFolderNameCalculated; } } if (String.IsNullOrEmpty(currentHTMLFolderName)) { if (!string.IsNullOrEmpty(WorkSpace.Instance.TestArtifactsFolder)) { currentHTMLFolderName = Path.Combine(WorkSpace.Instance.TestArtifactsFolder, System.IO.Path.GetFileName(runSetFolder)); } } if (!string.IsNullOrEmpty(selectedHTMLReportTemplateID.ToString())) { ObservableList <HTMLReportConfiguration> HTMLReportConfigurations = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <HTMLReportConfiguration>(); reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, HTMLReportConfigurations.Where(x => (x.ID == selectedHTMLReportTemplateID)).FirstOrDefault(), currentHTMLFolderName, isHTMLReportPermanentFolderNameUsed, currentConf.HTMLReportConfigurationMaximalFolderSize); } else { reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(runSetFolder), false, null, currentHTMLFolderName, isHTMLReportPermanentFolderNameUsed); } } else { Errors = "In order to get HTML report, please, perform executions before"; Reporter.HideStatusMessage(); Status = Ginger.Run.RunSetActions.RunSetActionBase.eRunSetActionStatus.Failed; return; } }