public override object SetReportAction(Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool offlineMode = false)
        {
            string executionLogFolder = string.Empty;

            if (!offlineMode)
            {
                executionLogFolder = ExecutionLogfolder;
            }
            ActionReport AR = GetActionReportData(action, context, executedFrom);

            if (System.IO.Directory.Exists(Path.Combine(executionLogFolder, action.ExecutionLogFolder)))
            {
                this.SaveObjToReporsitory(AR, Path.Combine(executionLogFolder, action.ExecutionLogFolder, "Action.txt"));

                // Save screenShots
                int screenShotCountPerAction = 0;
                for (var s = 0; s < action.ScreenShots.Count; s++)
                {
                    try
                    {
                        screenShotCountPerAction++;
                        var screenShotPath = Path.Combine(executionLogFolder, action.ExecutionLogFolder, string.Concat("ScreenShot_", AR.Seq, "_", screenShotCountPerAction.ToString(), ".png"));
                        if (executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation)
                        {
                            System.IO.File.Copy(action.ScreenShots[s], screenShotPath, true);
                        }
                        else
                        {
                            System.IO.File.Move(action.ScreenShots[s], screenShotPath);
                            action.ScreenShots[s] = screenShotPath;
                        }
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Failed to move screen shot of the action:'" + action.Description + "' to the Execution Logger folder", ex);
                        screenShotCountPerAction--;
                    }
                }
                //change the paths to Defect suggestion list
                var defectSuggestion = WorkSpace.Instance.RunsetExecutor.DefectSuggestionsList.FirstOrDefault(z => z.FailedActionGuid == action.Guid);
                if (defectSuggestion != null)
                {
                    defectSuggestion.ScreenshotFileNames = action.ScreenShots.ToList();
                }
            }
            else
            {
                Reporter.ToLog(eLogLevel.ERROR, "Failed to create ExecutionLogger JSON file for the Action :" + action.Description + " because directory not exists :" + Path.Combine(executionLogFolder, action.ExecutionLogFolder));
            }
            return(AR);
        }
예제 #2
0
        internal ActionReport GetActionReportData(Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom)
        {
            ActionReport AR = new ActionReport(action, context);

            AR.Seq = context.Activity.ExecutionLogActionCounter;
            if ((action.RunDescription != null) && (action.RunDescription != string.Empty))
            {
                if (mVE == null)
                {
                    mVE = new GingerCore.ValueExpression(context.Environment, null, new ObservableList <GingerCore.DataSource.DataSourceBase>(), false, "", false);
                }
                mVE.Value         = action.RunDescription;
                AR.RunDescription = mVE.ValueCalculated;
            }
            return(AR);
        }
예제 #3
0
        public override object SetReportAction(Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool offlineMode = false)
        {
            string executionLogFolder = string.Empty;

            if (!offlineMode)
            {
                executionLogFolder = ExecutionLogfolder;
            }
            ActionReport AR = GetActionReportData(action, context, executedFrom);

            if (System.IO.Directory.Exists(Path.Combine(executionLogFolder, action.ExecutionLogFolder)))
            {
                this.SaveObjToReporsitory(AR, Path.Combine(executionLogFolder, action.ExecutionLogFolder, "Action.txt"));

                // Save screenShots
                int screenShotCountPerAction = 0;
                for (var s = 0; s < action.ScreenShots.Count; s++)
                {
                    try
                    {
                        screenShotCountPerAction++;
                        if (executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation)
                        {
                            System.IO.File.Copy(action.ScreenShots[s], Path.Combine(executionLogFolder, action.ExecutionLogFolder, "ScreenShot_" + AR.Seq + "_" + screenShotCountPerAction.ToString() + ".png"), true);
                        }
                        else
                        {
                            System.IO.File.Move(action.ScreenShots[s], Path.Combine(executionLogFolder, action.ExecutionLogFolder, "ScreenShot_" + AR.Seq + "_" + screenShotCountPerAction.ToString() + ".png"));
                            action.ScreenShots[s] = Path.Combine(executionLogFolder, action.ExecutionLogFolder, "ScreenShot_" + AR.Seq + "_" + screenShotCountPerAction.ToString() + ".png");
                        }
                    }
                    catch (Exception ex)
                    {
                        Reporter.ToLog(eLogLevel.ERROR, "Failed to move screen shot of the action:'" + action.Description + "' to the Execution Logger folder", ex);
                        screenShotCountPerAction--;
                    }
                }
            }
            else
            {
                Reporter.ToLog(eLogLevel.ERROR, "Failed to create ExecutionLogger JSON file for the Action :" + action.Description + " because directory not exists :" + Path.Combine(executionLogFolder, action.ExecutionLogFolder));
            }
            return(AR);
        }
예제 #4
0
 public abstract object SetReportBusinessFlow(Context context, bool offlineMode = false, Amdocs.Ginger.Common.eExecutedFrom executedFrom = eExecutedFrom.Run, bool isConfEnable = false);
예제 #5
0
 public abstract object SetReportAction(Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool offlineMode = false);
예제 #6
0
 public override object SetReportAction(GingerCore.Actions.Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool offlineMode = false)
 {
     //return new LiteDbAction();
     return(GetActionReportData(action, context, executedFrom));//Returning ActionReport so we will get execution info on the console
 }
예제 #7
0
        public override object SetReportBusinessFlow(Context context, bool offlineMode, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool isConfEnable)
        {
            LiteDbBusinessFlow BFR = new LiteDbBusinessFlow();

            if (executedFrom == eExecutedFrom.Automation)
            {
                ClearSeq();
            }

            if (liteDbBFList.Count >= context.Runner.BusinessFlows.Count)
            {
                liteDbBFList.RemoveRange(0, context.Runner.BusinessFlows.Count);
            }
            if (lastBfStatus == eRunStatus.Stopped && context.BusinessFlow.RunStatus != eRunStatus.Stopped)
            {
                BFR._id = lastBfObjId;
                ClearSeq();
            }
            SetBfobjects(context, executedFrom);
            context.Runner.CalculateBusinessFlowFinalStatus(context.BusinessFlow);
            BFR.SetReportData(GetBFReportData(context.BusinessFlow, context.Environment));
            BFR.Seq = ++this.bfSeq;

            int ChildExecutableItemsCountActivity = 0;
            int ChildExecutedItemsCountActivity   = 0;
            int ChildPassedItemsCountActivity     = 0;

            ChildExecutableItemsCountActivity = context.BusinessFlow.Activities.Count(x => x.Active == true);
            ChildExecutedItemsCountActivity   = context.BusinessFlow.Activities.Where(ac => ac.Status == eRunStatus.Failed || ac.Status == eRunStatus.Passed || ac.Status == eRunStatus.FailIgnored).Count();
            ChildPassedItemsCountActivity     = context.BusinessFlow.Activities.Where(ac => ac.Status == eRunStatus.Passed).Count();

            BFR.ChildExecutableItemsCount.Add(HTMLReportConfiguration.eExecutionStatisticsCountBy.Activities.ToString(), ChildExecutableItemsCountActivity);
            BFR.ChildExecutedItemsCount.Add(HTMLReportConfiguration.eExecutionStatisticsCountBy.Activities.ToString(), ChildExecutedItemsCountActivity);
            BFR.ChildPassedItemsCount.Add(HTMLReportConfiguration.eExecutionStatisticsCountBy.Activities.ToString(), ChildPassedItemsCountActivity);

            int ChildExecutableItemsCountAction = 0;
            int ChildExecutedItemsCountAction   = 0;
            int ChildPassedItemsCountAction     = 0;

            foreach (LiteDbActivity activity in liteDbActivityList)
            {
                ChildExecutableItemsCountAction = ChildExecutableItemsCountAction + activity.ChildExecutableItemsCount;
                ChildExecutedItemsCountAction   = ChildExecutedItemsCountAction + activity.ChildExecutedItemsCount;
                ChildPassedItemsCountAction     = ChildPassedItemsCountAction + activity.ChildPassedItemsCount;
            }
            BFR.ChildExecutableItemsCount.Add(HTMLReportConfiguration.eExecutionStatisticsCountBy.Actions.ToString(), ChildExecutableItemsCountAction);
            BFR.ChildExecutedItemsCount.Add(HTMLReportConfiguration.eExecutionStatisticsCountBy.Actions.ToString(), ChildExecutedItemsCountAction);
            BFR.ChildPassedItemsCount.Add(HTMLReportConfiguration.eExecutionStatisticsCountBy.Actions.ToString(), ChildPassedItemsCountAction);

            if (context.BusinessFlow.LiteDbId != null && executedFrom == eExecutedFrom.Automation)
            {
                BFR._id = context.BusinessFlow.LiteDbId;
                var BFRToUpdate = liteDbManager.GetBfLiteData().IncludeAll().Find(x => x._id == BFR._id).ToList();
                if (BFRToUpdate.Count > 0)
                {
                    foreach (var activity in (BFRToUpdate[0] as LiteDbBusinessFlow).ActivitiesColl)
                    {
                        if (liteDbActivityList.Any(ac => ac._id == activity._id))
                        {
                            liteDbActivityList.RemoveAll(x => x._id == activity._id);
                        }
                    }
                    liteDbActivityList.AddRange((BFRToUpdate[0] as LiteDbBusinessFlow).ActivitiesColl);
                }
            }
            if (WorkSpace.Instance.Solution.LoggerConfigurations.ExecutionLoggerConfigurationIsEnabled)
            {
                if (offlineMode)
                {
                    // To check whether the execution is from Runset/Automate tab
                    if ((executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation))
                    {
                        context.BusinessFlow.ExecutionFullLogFolder = context.BusinessFlow.ExecutionLogFolder;
                    }
                    else if ((WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null))
                    {
                        context.BusinessFlow.ExecutionFullLogFolder = context.BusinessFlow.ExecutionLogFolder;
                    }
                    BFR.ActivitiesColl.AddRange(liteDbActivityList);
                    BFR.ActivitiesGroupsColl.AddRange(liteDbAGList);
                    SaveObjToReporsitory(BFR, liteDbManager.NameInDb <LiteDbBusinessFlow>());
                    liteDbActivityList.Clear();
                    liteDbAGList.Clear();
                }
                else
                {
                    BFR.ActivitiesColl.AddRange(liteDbActivityList);
                    BFR.ActivitiesGroupsColl.AddRange(liteDbAGList);
                    SaveObjToReporsitory(BFR, liteDbManager.NameInDb <LiteDbBusinessFlow>());
                    this.lastBfObjId = BFR._id;
                    if (liteDbBFList.Exists(bf => bf._id == this.lastBfObjId))
                    {
                        liteDbBFList.RemoveAll(bf => bf._id == this.lastBfObjId);
                    }
                    liteDbBFList.Add(BFR);
                    liteDbActivityList.Clear();
                    liteDbAGList.Clear();
                    //context.BusinessFlow.ExecutionFullLogFolder = Path.Combine(ExecutionLogfolder,context.BusinessFlow.ExecutionLogFolder);
                }
                if (executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation)
                {
                    this.ExecutionLogBusinessFlowsCounter = 0;
                    //this.BFCounter = 0;
                }
            }
            if (executedFrom == eExecutedFrom.Automation)
            {
                context.BusinessFlow.LiteDbId = BFR._id;
            }
            this.lastBfStatus = context.BusinessFlow.RunStatus;

            //return BFR;
            return(GetBFReportData(context.BusinessFlow, context.Environment));//Returning BusinessFlowReport so we will get execution info on the console
        }
        public override object SetReportBusinessFlow(Context context, bool offlineMode, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool isConfEnable)
        {
            BusinessFlowReport BFR = null;

            try
            {
                BFR = GetBFReportData(context.BusinessFlow, context.Environment);
                if (isConfEnable)
                {
                    if (offlineMode)
                    {
                        // To check whether the execution is from Runset/Automate tab
                        if ((executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation))
                        {
                            context.BusinessFlow.ExecutionFullLogFolder = context.BusinessFlow.ExecutionLogFolder;
                        }
                        else if ((WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null))
                        {
                            context.BusinessFlow.ExecutionFullLogFolder = context.BusinessFlow.ExecutionLogFolder;
                        }
                        SaveObjToReporsitory(BFR, Path.Combine(context.BusinessFlow.ExecutionFullLogFolder, "BusinessFlow.txt"));
                    }
                    else
                    {
                        if (!Directory.Exists(Path.Combine(ExecutionLogfolder, context.BusinessFlow.ExecutionLogFolder)))
                        {
                            CreateNewDirectory(Path.Combine(ExecutionLogfolder, context.BusinessFlow.ExecutionLogFolder));
                        }

                        // use Path.cOmbine
                        SaveObjToReporsitory(BFR, Path.Combine(ExecutionLogfolder, context.BusinessFlow.ExecutionLogFolder, "BusinessFlow.txt"));
                        context.BusinessFlow.ExecutionFullLogFolder = Path.Combine(ExecutionLogfolder, context.BusinessFlow.ExecutionLogFolder);
                    }
                    if (executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation)
                    {
                        this.ExecutionLogBusinessFlowsCounter = 0;
                        //this.BFCounter = 0;
                    }
                }
            }
            catch (Exception exc)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Exception occured " + exc.Message, exc);
            }

            return(BFR);
        }
예제 #9
0
 public IGingerRunner RunExecutioFrom(Amdocs.Ginger.Common.eExecutedFrom executedFrom)
 {
     return(new GingerRunner(executedFrom));
 }
예제 #10
0
        public override object SetReportBusinessFlow(Context context, bool offlineMode, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool isConfEnable)
        {
            BusinessFlowReport BFR = GetBFReportData(context.BusinessFlow, context.Environment);

            if (isConfEnable)
            {
                if (offlineMode)
                {
                    // To check whether the execution is from Runset/Automate tab
                    if ((executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation))
                    {
                        context.BusinessFlow.ExecutionFullLogFolder = context.BusinessFlow.ExecutionLogFolder;
                    }
                    else if ((WorkSpace.Instance.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null))
                    {
                        context.BusinessFlow.ExecutionFullLogFolder = context.BusinessFlow.ExecutionLogFolder;
                    }
                    SaveObjToReporsitory(BFR, Path.Combine(context.BusinessFlow.ExecutionFullLogFolder, "BusinessFlow.txt"));
                }
                else
                {
                    // use Path.cOmbine
                    SaveObjToReporsitory(BFR, Path.Combine(ExecutionLogfolder, context.BusinessFlow.ExecutionLogFolder, "BusinessFlow.txt"));
                    context.BusinessFlow.ExecutionFullLogFolder = Path.Combine(ExecutionLogfolder, context.BusinessFlow.ExecutionLogFolder);
                }
                if (executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation)
                {
                    this.ExecutionLogBusinessFlowsCounter = 0;
                    //this.BFCounter = 0;
                }
            }
            return(BFR);
        }
예제 #11
0
        public override object SetReportAction(GingerCore.Actions.Act action, Context context, Amdocs.Ginger.Common.eExecutedFrom executedFrom, bool offlineMode = false)
        {
            //save screenshots
            string executionLogFolder = executionLoggerHelper.GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder);

            int screenShotCountPerAction = 0;

            for (var s = 0; s < action.ScreenShots.Count; s++)
            {
                try
                {
                    screenShotCountPerAction++;
                    string imagesFolderName = Path.Combine(executionLogFolder, "LiteDBImages");
                    var    screenShotName   = string.Concat(@"ScreenShot_", action.Guid, "_", action.StartTimeStamp.ToString("hhmmss"), "_" + screenShotCountPerAction.ToString(), ".png");

                    var completeSSPath = Path.Combine(imagesFolderName, screenShotName);
                    if (!System.IO.Directory.Exists(imagesFolderName))
                    {
                        System.IO.Directory.CreateDirectory(imagesFolderName);
                    }
                    if (executedFrom == Amdocs.Ginger.Common.eExecutedFrom.Automation)
                    {
                        System.IO.File.Copy(action.ScreenShots[s], completeSSPath, true);
                    }
                    else
                    {
                        System.IO.File.Move(action.ScreenShots[s], completeSSPath);
                        action.ScreenShots[s] = completeSSPath;
                    }
                }
                catch (Exception ex)
                {
                    Reporter.ToLog(eLogLevel.ERROR, "Failed to move screen shot of the action:'" + action.Description + "' to the Execution Logger folder", ex);
                    screenShotCountPerAction--;
                }
            }

            return(GetActionReportData(action, context, executedFrom));//Returning ActionReport so we will get execution info on the console
        }