Ejemplo n.º 1
0
        private object MapActionToLiteDb(GingerCore.Actions.Act action, Context context, eExecutedFrom executedFrom)
        {
            bool         isActExsits        = false;
            string       executionLogFolder = executionLoggerHelper.GetLoggerDirectory(WorkSpace.Instance.Solution.LoggerConfigurations.CalculatedLoggerFolder);
            LiteDbAction liteDbAction       = new LiteDbAction();

            liteDbAction.SetReportData(GetActionReportData(action, context, executedFrom));
            liteDbAction.Seq     = ++this.actionSeq;
            liteDbAction.Wait    = action.Wait;
            liteDbAction.TimeOut = action.Timeout;
            if (action.LiteDbId != null && executedFrom == eExecutedFrom.Automation)
            {
                liteDbAction._id = action.LiteDbId;
            }
            // Save screenShots
            int screenShotCountPerAction = 0;

            for (var s = 0; s < action.ScreenShots.Count; s++)
            {
                try
                {
                    screenShotCountPerAction++;
                    string imagesFolderName = Path.Combine(executionLogFolder, "LiteDBImages");
                    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], imagesFolderName + @"\ScreenShot_" + liteDbAction.GUID + "_" + liteDbAction.StartTimeStamp.ToString("hhmmss") + "_" + screenShotCountPerAction.ToString() + ".png", true);
                    }
                    else
                    {
                        System.IO.File.Move(action.ScreenShots[s], imagesFolderName + @"\ScreenShot_" + liteDbAction.GUID + "_" + liteDbAction.StartTimeStamp.ToString("hhmmss") + "_" + screenShotCountPerAction.ToString() + ".png");
                        action.ScreenShots[s] = imagesFolderName + @"\ScreenShot_" + liteDbAction.GUID + "_" + liteDbAction.StartTimeStamp.ToString("hhmmss") + "_" + 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--;
                }
            }
            liteDbAction.ScreenShots = action.ScreenShots.ToList();

            isActExsits = liteDbActionList.Any(x => x.GUID == liteDbAction.GUID);
            if (isActExsits)
            {
                liteDbActionList.RemoveAll(x => x.GUID == liteDbAction.GUID);
            }
            liteDbActionList.Add(liteDbAction);
            SaveObjToReporsitory(liteDbAction, liteDbManager.NameInDb <LiteDbAction>());
            if (executedFrom == eExecutedFrom.Automation)
            {
                action.LiteDbId = liteDbAction._id;
            }
            return(liteDbAction);
        }
Ejemplo n.º 2
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
        }
Ejemplo n.º 3
0
        private object MapActionToLiteDb(GingerCore.Actions.Act action, Context context, eExecutedFrom executedFrom)
        {
            bool         isActExsits  = false;
            LiteDbAction liteDbAction = new LiteDbAction();

            liteDbAction.SetReportData(GetActionReportData(action, context, executedFrom));
            liteDbAction.Seq     = ++this.actionSeq;
            liteDbAction.Wait    = action.Wait;
            liteDbAction.TimeOut = action.Timeout;
            if (action.LiteDbId != null && executedFrom == eExecutedFrom.Automation)
            {
                liteDbAction._id = action.LiteDbId;
            }

            //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();
            }

            liteDbAction.ScreenShots = action.ScreenShots.ToList();

            isActExsits = liteDbActionList.Any(x => x.GUID == liteDbAction.GUID);
            if (isActExsits)
            {
                liteDbActionList.RemoveAll(x => x.GUID == liteDbAction.GUID);
            }
            liteDbActionList.Add(liteDbAction);
            SaveObjToReporsitory(liteDbAction, liteDbManager.NameInDb <LiteDbAction>());
            if (executedFrom == eExecutedFrom.Automation)
            {
                action.LiteDbId = liteDbAction._id;
            }
            return(liteDbAction);
        }
Ejemplo n.º 4
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
 }