Exemplo n.º 1
0
        public RunnerPage(GingerExecutionEngine runner, Context context, bool Viewmode = false)
        {
            InitializeComponent();
            mExecutorEngine = runner;
            mContext        = context;
            ViewMode1       = Viewmode;
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xBusinessflowsTotalCount, Label.ContentProperty, mExecutorEngine, nameof(GingerExecutionEngine.TotalBusinessflow));
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xStatus, StatusItem.StatusProperty, mExecutorEngine.GingerRunner, nameof(GingerRunner.Status), BindingMode.OneWay);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xStatusLabel, ImageMakerControl.ImageTypeProperty, mExecutorEngine.GingerRunner, nameof(GingerRunner.Status), bindingConvertor: new StatusIconConverter(), BindingMode.OneWay);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xRunnerActive, ucButton.ButtonImageTypeProperty, mExecutorEngine.GingerRunner, nameof(GingerRunner.Active), bindingConvertor: new ActiveIconConverter(), BindingMode.TwoWay);
            UpdateRunnerInfo();
            if (Viewmode)
            {
                pageGrid.IsEnabled = false;
            }

            mDispatcherTimer          = new DispatcherTimer();
            mDispatcherTimer.Interval = new TimeSpan(0, 0, 1); // one second
            mDispatcherTimer.Tick    += dispatcherTimerElapsedTick;
            mDispatcherTimer.Start();
            UpdateExecutionStats();

            mRunnerPageListener            = new RunnerPageListener();
            mRunnerPageListener.UpdateStat = HandleUpdateStat;
            runner.RunListeners.Add(mRunnerPageListener);

            if (WorkSpace.Instance.RunningInExecutionMode)
            {
                xExecutionOperationsPnl.Visibility = Visibility.Collapsed;
                xOperationsPnl.Visibility          = Visibility.Collapsed;
            }
        }
Exemplo n.º 2
0
        public void TestInitialize()
        {
            BusinessFlow mBF = new BusinessFlow();

            mBF.Activities = new ObservableList <Activity>();
            mBF.Name       = "BF Non-Driver Action Test";
            mBF.Active     = true;

            Activity activity = new Activity();

            mBF.Activities.Add(activity);
            mBF.CurrentActivity = activity;

            mGR = new GingerExecutionEngine(new GingerRunner());
            mGR.CurrentSolution     = new Ginger.SolutionGeneral.Solution();
            mGR.CurrentBusinessFlow = mBF;
            mGR.BusinessFlows.Add(mBF);


            Reporter.ToLog(eLogLevel.DEBUG, "Creating the GingerCoreNET WorkSpace");
            WorkSpaceEventHandler WSEH = new WorkSpaceEventHandler();

            WorkSpace.Init(WSEH);
            WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository();
            isOSWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
        }
Exemplo n.º 3
0
 public virtual void SetReportRunner(GingerExecutionEngine gingerRunner, GingerReport gingerReport, ParentGingerData gingerData, Context mContext, string filename, int runnerCount)
 {
     if (gingerRunner == null)
     {
         gingerReport.Seq          = this.GingerData.Seq;
         gingerReport.EndTimeStamp = DateTime.Now.ToUniversalTime();
         gingerReport.GUID         = this.GingerData.Ginger_GUID.ToString();
         gingerReport.Name         = this.GingerData.GingerName.ToString();
         gingerReport.ApplicationAgentsMappingList = this.GingerData.GingerAggentMapping;
         gingerReport.EnvironmentName = mContext.Environment != null ? mContext.Environment.Name : string.Empty;
         gingerReport.Elapsed         = (double)gingerReport.Watch.ElapsedMilliseconds / 1000;
     }
     else
     {
         gingerReport.GingerRunner = gingerRunner.GingerRunner;
         if (runnerCount != 0)
         {
             gingerReport.Seq = runnerCount;
         }
         else
         {
             gingerReport.Seq = this.GingerData.Seq;  //!!!
         }
         gingerReport.EndTimeStamp = DateTime.Now.ToUniversalTime();
         gingerReport.GUID         = gingerRunner.GingerRunner.Guid.ToString();
         gingerReport.Name         = gingerRunner.GingerRunner.Name;
         gingerReport.ApplicationAgentsMappingList = gingerRunner.GingerRunner.ApplicationAgents.Select(a => a.AgentName + "_:_" + a.AppName).ToList();
         gingerReport.EnvironmentName = gingerRunner.GingerRunner.ProjEnvironment != null ? gingerRunner.GingerRunner.ProjEnvironment.Name : string.Empty;
         gingerReport.Elapsed         = (double)gingerRunner.Elapsed / 1000;
         if (gingerReport.LogFolder == null && !(string.IsNullOrEmpty(filename)))
         {
             gingerReport.LogFolder = filename;
         }
     }
 }
Exemplo n.º 4
0
        public static void ClearAndResetVirtualAgents(RunSetConfig runset, GingerExecutionEngine runner)
        {
            lock (locker)
            {
                var appAgents = runner.GingerRunner.ApplicationAgents.Where(x => x.Agent != null && ((Agent)x.Agent).IsVirtual).ToList();

                if (appAgents.Count > 0)
                {
                    for (var i = 0; i < appAgents.Count; i++)
                    {
                        var virtualAgent = (Agent)appAgents[i].Agent;

                        var realAgent = runset.ActiveAgentList.Where(x => ((Agent)x).Guid.ToString() == virtualAgent.ParentGuid.ToString()).FirstOrDefault();

                        if (realAgent != null)
                        {
                            var runsetVirtualAgent = runset.ActiveAgentList.Where(x => ((Agent)x).Guid == ((Agent)virtualAgent).Guid).FirstOrDefault();
                            appAgents[i].Agent = realAgent;

                            if (runsetVirtualAgent != null)
                            {
                                runset.ActiveAgentList.Remove(runsetVirtualAgent);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 private void CalculateARC(ActReturnValue ARC)
 {
     // We do only  simple calculation not including BF or proj env params so it will work
     ARC.ExpectedCalculated = ARC.Expected;
     GingerExecutionEngine.ReplaceActualPlaceHolder(ARC);
     GingerExecutionEngine.CalculateARCStatus(ARC);
 }
 public bool OfflineRunnerExecutionLog(GingerExecutionEngine runner, string logFolderPath, int runnerCount = 0)
 {
     try
     {
         mBusinessFlowCounter = 0;
         ObservableList <BusinessFlow> listBF = runner.BusinessFlows;
         int counter = 1;
         foreach (BusinessFlow bf in listBF)
         {
             string reportpath = Path.Combine(logFolderPath, counter.ToString() + " " + folderNameNormalazing(bf.Name));
             System.IO.Directory.CreateDirectory(reportpath);
             this.ExecutionLogBusinessFlowsCounter = counter;
             ((ExecutionLogger)mExecutionLogger).ExecutionLogBusinessFlowsCounter = counter;
             // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
             runner.CalculateBusinessFlowFinalStatus(bf, true);
             if (bf.RunStatus != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed && bf.RunStatus != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed && bf.RunStatus != Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped)
             {
                 continue;
             }
             runner.SetBFOfflineData(bf, this, reportpath);
             mBusinessFlowCounter++;
             runner.ExecutionLogFolder = Path.Combine(logFolderPath, mBusinessFlowCounter + " " + folderNameNormalazing(bf.Name));
             counter++;
         }
         RunnerRunEnd(meventtime, runner.GingerRunner, logFolderPath, runnerCount, true);
         // GingerEnd(runner, logFolderPath, runnerCount);  // !!!!!!!!!!!!!!!!!!!!! FIXME
         runner.ExecutionLogFolder = string.Empty;
         return(true);
     }
     catch (Exception ex)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Execution Logger Failed to do Offline BusinessFlow Execution Log", ex);
         return(false);
     }
 }
 public override void SetReportRunner(GingerExecutionEngine gingerRunner, GingerReport gingerReport, ParentGingerData gingerData, Context mContext, string filename, int runnerCount)
 {
     if (gingerRunner.ExecutionLoggerManager.Configuration.ExecutionLoggerConfigurationIsEnabled)
     {
         base.SetReportRunner(gingerRunner, gingerReport, gingerData, mContext, filename, runnerCount);
         SaveObjToReporsitory(gingerReport, Path.Combine(gingerReport.LogFolder, "Ginger.txt"));
     }
 }
Exemplo n.º 8
0
 public void InitRunners()
 {
     AllPreviousBusinessFlowRuns.Clear();
     foreach (GingerRunner gingerRunner in Runners)
     {
         GingerExecutionEngine ExecutorEngine = new GingerExecutionEngine(gingerRunner);
         InitRunner(gingerRunner, ExecutorEngine);
     }
 }
 public void TestInitialize()
 {
     WorkSpace.Init(new WorkSpaceEventHandler());
     WorkSpace.Instance.SolutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository();
     gingerRunner = new GingerExecutionEngine(new GingerRunner(), Amdocs.Ginger.Common.eExecutedFrom.Automation);
     if (WorkSpace.Instance.Solution?.SolutionOperations == null)
     {
         WorkSpace.Instance.Solution.SolutionOperations = new SolutionOperations(WorkSpace.Instance.Solution);
     }
 }
        public ApplicationAgentSelectionPage(GingerExecutionEngine gingerRunner, ApplicationAgent applicationAgent)
        {
            InitializeComponent();

            mGingerRunner     = gingerRunner;
            mApplicationAgent = applicationAgent;

            SetPossibleAgentsGridView();
            SetPossibleAgentsGridData();
        }
Exemplo n.º 11
0
        /// <summary>
        /// This method is used to get the app agent
        /// </summary>
        /// <param name="activity"></param>
        /// <param name="runner"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public static ApplicationAgent GetAppAgent(Activity activity, GingerExecutionEngine runner, Context context)
        {
            ApplicationAgent appAgent = null;

            if (context != null && activity != null)
            {
                appAgent = (ApplicationAgent)runner.GingerRunner.ApplicationAgents.Where(x => x.AppName == activity.TargetApplication).FirstOrDefault();
            }
            return(appAgent);
        }
Exemplo n.º 12
0
 public void ConfigureRunnerForExecution(GingerExecutionEngine runner)
 {
     runner.SetExecutionEnvironment(RunsetExecutionEnvironment, WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <ProjEnvironment>());
     runner.CurrentSolution      = WorkSpace.Instance.Solution;
     runner.SolutionAgents       = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>();
     runner.GingerRunner.DSList  = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <DataSourceBase>();
     runner.SolutionApplications = WorkSpace.Instance.Solution.ApplicationPlatforms;
     runner.SolutionFolder       = WorkSpace.Instance.Solution.Folder;
     //runner.ExecutionLoggerManager.Configuration = WorkSpace.Instance.Solution.ExecutionLoggerConfigurationSetList;
 }
Exemplo n.º 13
0
        Agent prep()
        {
            mGingerGrid = WorkSpace.Instance.LocalGingerGrid;

            // Start one DummyDriver - in process, so we can test whats going on everywhere
            mDummyDriver = new DummyDriver();
            GingerNode gingerNode = new GingerNode(mDummyDriver);

            gingerNode.StartGingerNode("N1", HubIP: SocketHelper.GetLocalHostIP(), HubPort: mGingerGrid.Port);

            // Wait for the Grid to be up and the node connected
            // max 30 seconds
            Stopwatch st = Stopwatch.StartNew();

            while (!gingerNode.Connected && st.ElapsedMilliseconds < 30000)
            {
                Thread.Sleep(100);
            }
            if (!gingerNode.Connected)
            {
                throw new Exception(">>>>>>>>>>>>>>>> GingerNode didn't connect to grid <<<<<<<<<<<<<<<<<<<<< " + mPluginId + "." + mServiceId);
            }

            st.Restart();

            while (mGingerGrid.NodeList.Count == 0 && st.ElapsedMilliseconds < 30000)
            {
                Thread.Sleep(100);
            }

            if (mGingerGrid.NodeList.Count == 0)
            {
                throw new Exception(">>>>>>>>>>>>>>>> NodeList count =0, no node connected <<<<<<<<<<<<<<<<<<<<< " + mPluginId + "." + mServiceId);
            }

            WorkSpace.Instance.PlugInsManager.PluginServiceIsSeesionDictionary.Add(mPluginId + "." + mServiceId, true);


            //TODO: handle no GG node found

            Agent agent = new Agent();

            agent.Name      = "agent 1";
            agent.AgentType = Agent.eAgentType.Service;
            agent.PluginId  = mPluginId;
            agent.ServiceId = mServiceId;

            mGingerRunner = new GingerExecutionEngine(new GingerRunner());
            mGingerRunner.GingerRunner.ApplicationAgents.Add(new ApplicationAgent()
            {
                AppName = cWebApp, Agent = agent
            });

            return(agent);
        }
Exemplo n.º 14
0
        public static RunSetConfig CreateNewRunset(string runSetName = "", RepositoryFolder <RunSetConfig> runSetsFolder = null)
        {
            if (string.IsNullOrEmpty(runSetName))
            {
                do
                {
                    if (!string.IsNullOrEmpty(runSetName.Trim()))
                    {
                        Reporter.ToUser(eUserMsgKey.DuplicateRunsetName, runSetName);
                    }

                    bool returnWindow = InputBoxWindow.OpenDialog(string.Format("Add New {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)),
                                                                  string.Format("{0} Name:", GingerDicser.GetTermResValue(eTermResKey.RunSet)),
                                                                  ref runSetName);

                    if (returnWindow)
                    {
                        if (string.IsNullOrEmpty(runSetName.Trim()))
                        {
                            Reporter.ToUser(eUserMsgKey.ValueIssue, "Value cannot be empty");
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }while (string.IsNullOrEmpty(runSetName.Trim()) || WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <RunSetConfig>().Where(r => r.ItemName.ToLower() == runSetName.ToLower()).FirstOrDefault() != null);
            }

            RunSetConfig runSetConfig = new RunSetConfig();

            runSetConfig.Name = runSetName;

            GingerRunner gingerRunner = new GingerRunner {
                Name = "Runner 1"
            };
            GingerExecutionEngine gingerExecutionEngine = new GingerExecutionEngine(gingerRunner);

            gingerRunner.Executor = gingerExecutionEngine;

            runSetConfig.GingerRunners.Add(gingerRunner);
            runSetConfig.AddCategories();

            if (runSetsFolder == null)
            {
                WorkSpace.Instance.SolutionRepository.AddRepositoryItem(runSetConfig);
            }
            else
            {
                runSetsFolder.AddRepositoryItem(runSetConfig);
            }

            return(runSetConfig);
        }
Exemplo n.º 15
0
        public ApplicationAgentsMapPage(GingerExecutionEngine runner, Context context, bool allowAgentsManipulation = true)
        {
            InitializeComponent();
            mRunner  = runner;
            mContext = context;
            AllowAgentsManipulation = allowAgentsManipulation;
            xAppAgentsListBox.Tag   = AllowAgentsManipulation;//Placed here for binding with list dataTemplate- need better place
            mRunner.GingerRunner.PropertyChanged += MGR_PropertyChanged;

            RefreshApplicationAgentsList();
        }
Exemplo n.º 16
0
        /// <summary>
        /// This method is used to check if the agent is running or not
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static Agent GetDriverAgent(Activity activity, GingerExecutionEngine runner, Context context)
        {
            Agent            agent    = null;
            ApplicationAgent appAgent = GetAppAgent(activity, runner, context);

            if (appAgent != null && appAgent.Agent != null)
            {
                agent = appAgent.Agent;
            }
            return(agent);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Should be deleted after switch will be fully done to serialized objects
        /// </summary>
        public ReportInfo(ProjEnvironment Env, GingerExecutionEngine GR, bool ReportOnlyExecuted = false) // to remove after discussion !!!
        {
            mProjEnvironment = Env;
            mBFESs           = GR.GetAllBusinessFlowsExecutionSummary(ReportOnlyExecuted);

            TotalExecutionTime = TimeSpan.FromMilliseconds(GR.Elapsed.GetValueOrDefault());

            DateCreated          = DateTime.Now.ToString();
            DateCreatedShort     = DateTime.Now.ToString("MM/dd");
            ExecutionEnv         = mProjEnvironment.Name;
            ExecutionElapsedTime = TotalExecutionTime;
        }
Exemplo n.º 18
0
        public void FLowControlStatusCalculationTest()
        {
            FlowControl FC = new FlowControl();

            FC.Operator = eFCOperator.ActionPassed;


            Activity LastActivity = new Activity();
            ActDummy act          = new ActDummy();

            act.Status = eRunStatus.Passed;
            bool FcStatus = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");

            Assert.AreEqual(true, FcStatus);
            act.Status = eRunStatus.Failed;
            FcStatus   = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(false, FcStatus);



            FC.Operator = eFCOperator.ActionFailed;

            act.Status = eRunStatus.Failed;
            FcStatus   = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(true, FcStatus);

            act.Status = eRunStatus.Passed;
            FcStatus   = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(false, FcStatus);



            FC.Operator         = eFCOperator.LastActivityPassed;
            LastActivity.Status = eRunStatus.Passed;

            FcStatus = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(true, FcStatus);
            LastActivity.Status = eRunStatus.Failed;
            FcStatus            = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(false, FcStatus);



            FC.Operator         = eFCOperator.LastActivityFailed;
            LastActivity.Status = eRunStatus.Failed;

            FcStatus = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(true, FcStatus);
            LastActivity.Status = eRunStatus.Passed;

            FcStatus = GingerExecutionEngine.CalculateFlowControlStatus(act, LastActivity, null, FC.Operator, "");
            Assert.AreEqual(false, FcStatus);
        }
Exemplo n.º 19
0
        private void ShowStatus()
        {
            // Why we create new GR? !!!
            GingerExecutionEngine Gr = new GingerExecutionEngine(new GingerRunner());

            foreach (Activity activity in mContext.BusinessFlow.Activities)
            {
                Gr.CalculateActivityFinalStatus(activity);
            }
            Gr.CalculateBusinessFlowFinalStatus(mContext.BusinessFlow);
            StatusLabel.Content    = mContext.BusinessFlow.RunStatus;
            StatusLabel.Foreground = General.GetStatusBrush(mContext.BusinessFlow.RunStatus);
        }
Exemplo n.º 20
0
        public GingerRunnerConfigurationsPage(GingerExecutionEngine runner, ePageViewMode pageViewMode, Context context)
        {
            InitializeComponent();

            mRunner       = runner;
            mPageViewMode = pageViewMode;
            mContext      = context;

            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mRunner.GingerRunner, nameof(GingerRunner.Name));
            xShowIDUC.Init(mRunner.GingerRunner);

            mRunner.UpdateApplicationAgents();
            if (mPageViewMode == ePageViewMode.AutomatePage)
            {
                xAppAgentsMappingFrame.Content = new ApplicationAgentsMapPage(mRunner, mContext);
            }
            else
            {
                xAppAgentsMappingFrame.Content = new ApplicationAgentsMapPage(mRunner, mContext, false);
            }

            List <int> waitOptions = new List <int>()
            {
                0, 1, 2, 3, 4, 5
            };

            xAutoWaitComboBox.ItemsSource = waitOptions;
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xAutoWaitComboBox, ComboBox.SelectedValueProperty, mRunner.GingerRunner, nameof(GingerRunner.AutoWait));

            GingerCore.General.FillComboFromEnumObj(xRunOptionComboBox, mRunner.GingerRunner.RunOption);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xRunOptionComboBox, ComboBox.SelectedValueProperty, mRunner.GingerRunner, nameof(GingerRunner.RunOption));

            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xSimulationMode, CheckBox.IsCheckedProperty, mRunner.GingerRunner, nameof(GingerRunner.RunInSimulationMode));

            SetEnvironments();
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xUseSpecificEnvChkbox, CheckBox.IsCheckedProperty, mRunner.GingerRunner, nameof(GingerRunner.UseSpecificEnvironment));
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xSpecificEnvComboBox, ComboBox.SelectedItemProperty, mRunner.GingerRunner, nameof(GingerRunner.ProjEnvironment));
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xSpecificEnvComboBox, ComboBox.SelectedValueProperty, mRunner.GingerRunner, nameof(GingerRunner.SpecificEnvironmentName));


            xExecutionTags.Init(mRunner.GingerRunner.FilterExecutionTags);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xExecutionTagsChkbox, CheckBox.IsCheckedProperty, mRunner.GingerRunner, nameof(GingerRunner.FilterExecutionByTags));

            if (mPageViewMode == ePageViewMode.AutomatePage)
            {
                xNamePnl.Visibility             = Visibility.Collapsed;
                xRunOptionPnl.Visibility        = Visibility.Collapsed;
                xUseSpecificEnvChkbox.IsEnabled = false;
            }
        }
Exemplo n.º 21
0
        public void TestNGOperationTest()
        {
            //Arrange
            ObservableList <BusinessFlow> bfList = SR.GetAllRepositoryItems <BusinessFlow>();
            BusinessFlow BF1 = bfList[0];
            ObservableList <Activity> activityList = BF1.Activities;

            BF1.Active = true;
            GingerExecutionEngine mGRForRunset = new GingerExecutionEngine(new GingerRunner());

            mGRForRunset.GingerRunner.Name = "Test Runner";
            Agent a = new Agent();

            a.DriverType = Agent.eDriverType.SeleniumChrome;
            mGRForRunset.SolutionAgents = new ObservableList <Agent>();
            mGRForRunset.SolutionAgents.Add(a);
            mGRForRunset.GingerRunner.ApplicationAgents.Add(new ApplicationAgent()
            {
                AppName = "SCM", Agent = a
            });
            mGRForRunset.SolutionApplications = new ObservableList <ApplicationPlatform>();
            mGRForRunset.SolutionApplications.Add(new ApplicationPlatform()
            {
                AppName = "SCM", Platform = ePlatformType.Web, Description = "New application"
            });
            mGRForRunset.BusinessFlows.Add(BF1);
            WorkSpace.Instance.SolutionRepository             = SR;
            mGRForRunset.GingerRunner.SpecificEnvironmentName = environment.Name;
            mGRForRunset.GingerRunner.UseSpecificEnvironment  = false;
            RunSetConfig runSetConfig1 = new RunSetConfig();

            mGRForRunset.IsUpdateBusinessFlowRunList = true;
            runSetConfig1.GingerRunners.Add(mGRForRunset.GingerRunner);
            runSetConfig1.UpdateRunnersBusinessFlowRunsList();
            runSetConfig1.mRunModeParallel = false;
            RunSetActionGenerateTestNGReport testNGAction = CreateTestNGOperation();

            runSetConfig1.RunSetActions.Add(testNGAction);
            RunsetExecutor GMR1 = new RunsetExecutor();

            GMR1.RunsetExecutionEnvironment = environment;
            GMR1.RunSetConfig = runSetConfig1;
            WorkSpace.Instance.RunsetExecutor = GMR1;

            //Act
            GMR1.RunSetConfig.RunSetActions[0].runSetActionBaseOperations.ExecuteWithRunPageBFES();

            //Assert
            Assert.AreEqual(GMR1.RunSetConfig.RunSetActions[0].Status, RunSetActionBase.eRunSetActionStatus.Completed);
        }
Exemplo n.º 22
0
        /// <summary>
        /// This method is used to check if the agent is running or not
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static bool CheckIfAgentIsRunning(Activity activity, GingerExecutionEngine runner, Context context, out IWindowExplorer windowExplorerDriver)
        {
            bool isRunning = false;

            windowExplorerDriver = null;
            ApplicationAgent appAgent = GetAppAgent(activity, runner, context);

            if (appAgent != null && appAgent.Agent != null && ((AgentOperations)appAgent.Agent.AgentOperations).Driver != null && ((AgentOperations)appAgent.Agent.AgentOperations).Driver.IsRunning())
            {
                if (((AgentOperations)appAgent.Agent.AgentOperations).Driver is IWindowExplorer)
                {
                    windowExplorerDriver = (IWindowExplorer)((AgentOperations)appAgent.Agent.AgentOperations).Driver;
                }
                isRunning = true;
            }
            return(isRunning);
        }
Exemplo n.º 23
0
        /// <summary>
        /// Should be deleted after switch will be fully done to serialized objects
        /// </summary>
        public ReportInfo(ProjEnvironment Env, BusinessFlow BF, GingerExecutionEngine GR = null) // to remove after discussion !!!
        {
            mProjEnvironment = Env;
            mBFESs           = new ObservableList <BusinessFlowExecutionSummary>();
            BusinessFlowExecutionSummary BFES = new BusinessFlowExecutionSummary();

            BFES.BusinessFlowName           = BF.Name;
            BFES.BusinessFlowRunDescription = BF.RunDescription;
            BFES.Status              = BF.RunStatus;
            BFES.Activities          = BF.Activities.Count;
            BFES.Actions             = BF.GetActionsCount();
            BFES.Validations         = BF.GetValidationsCount();
            BFES.ExecutionVariabeles = BF.GetBFandActivitiesVariabeles(true);
            BFES.BusinessFlow        = BF;
            BFES.Selected            = true;
            if (GR != null)
            {
                BFES.BusinessFlowExecLoggerFolder = Path.Combine(GR.ExecutionLoggerManager.ExecutionLogfolder, BF.ExecutionLogFolder);
            }

            if (mBFESs != null)
            {
                mBFESs.Clear();
            }
            mBFESs.Add(BFES);

            mGingersMultiRun = null;
            // Set all General info
            if (BF.Elapsed != null)
            {
                TotalExecutionTime = TimeSpan.FromSeconds((long)BF.ElapsedSecs);
            }
            else
            {
                TotalExecutionTime = new TimeSpan(0);
            }

            ExecutionElapsedTime = TotalExecutionTime;
            DateCreated          = DateTime.Now.ToString();
            ExecutionEnv         = mProjEnvironment.Name;
            DateCreatedShort     = DateTime.Now.ToString("MM/dd");
        }
Exemplo n.º 24
0
        private void RunBusinessFlow()
        {
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + "Name?");
            string       BizFlowName  = Console.ReadLine();
            BusinessFlow businessFlow = (from x in SR.GetAllRepositoryItems <BusinessFlow>() where x.Name == BizFlowName select x).SingleOrDefault();

            if (businessFlow == null)
            {
                Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " not found");
                return;
            }
            GingerExecutionEngine gingerRunner = new GingerExecutionEngine(new GingerRunner());

            gingerRunner.RunBusinessFlow(businessFlow, true);

            Console.WriteLine("Execution Completed");
            Console.WriteLine("----------------------------");
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + ": " + businessFlow.Name);
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Description: " + businessFlow.Description);
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " Status: " + businessFlow.RunStatus);
            Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.Activities) + " Count: " + businessFlow.Activities.Count);
            Console.WriteLine("----------------------------");
            foreach (Activity activity in businessFlow.Activities)
            {
                Console.WriteLine(GingerDicser.GetTermResValue(eTermResKey.Activity) + ": " + activity.ActivityName + " Status: " + activity.Status);

                Console.WriteLine("Actions Found:" + activity.Acts.Count);
                foreach (Act act in activity.Acts)
                {
                    Console.WriteLine("------");
                    Console.WriteLine("Action:" + act.Description);
                    Console.WriteLine("Description:" + act.ActionDescription);
                    Console.WriteLine("Type:" + act.ActionType);
                    Console.WriteLine("Class:" + act.ActClass);
                    Console.WriteLine("Status:" + act.Status);
                    Console.WriteLine("Error:" + act.Error);
                    Console.WriteLine("ExInfo:" + act.ExInfo);
                }
                Console.WriteLine("----------");
            }
        }
Exemplo n.º 25
0
        /// <summary>
        /// This method is used to Start the agent
        /// </summary>
        public static bool StartAgent(Activity activity, GingerExecutionEngine runner, Context context, out IWindowExplorer windowExplorerDriver)
        {
            bool isAgentStarted = false;

            windowExplorerDriver = null;
            ApplicationAgent appAgent = GetAppAgent(activity, runner, context);

            if (appAgent != null)
            {
                if (((AgentOperations)appAgent.Agent.AgentOperations).Driver == null)
                {
                    appAgent.Agent.AgentOperations.StartDriver();
                    isAgentStarted = true;
                }
                else if (!((AgentOperations)appAgent.Agent.AgentOperations).Driver.IsRunning())
                {
                    if (Reporter.ToUser(eUserMsgKey.PleaseStartAgent, eUserMsgOption.OKCancel, eUserMsgSelection.OK) == eUserMsgSelection.OK)
                    {
                        appAgent.Agent.AgentOperations.StartDriver();
                        isAgentStarted = true;
                    }
                    else
                    {
                        isAgentStarted = false;
                    }
                }
                DriverBase driver = ((AgentOperations)appAgent.Agent.AgentOperations).Driver;
                if (driver is IWindowExplorer)
                {
                    windowExplorerDriver = (IWindowExplorer)((AgentOperations)appAgent.Agent.AgentOperations).Driver;
                }
            }
            else
            {
                isAgentStarted = false;
            }
            return(isAgentStarted);
        }
Exemplo n.º 26
0
 public static Amdocs.Ginger.CoreNET.Execution.eRunStatus GetRunnerStatus(GingerExecutionEngine gingerRunner)
 {
     if (gingerRunner.BusinessFlows != null && gingerRunner.BusinessFlows.Count > 0)
     {
         if ((from x in gingerRunner.BusinessFlows.ToList() where x.RunStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed select x).Count() > 0)
         {
             return(Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed);
         }
         else if ((from x in gingerRunner.BusinessFlows.ToList() where x.RunStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Blocked select x).Count() > 0)
         {
             return(Amdocs.Ginger.CoreNET.Execution.eRunStatus.Blocked);
         }
         else if ((from x in gingerRunner.BusinessFlows.ToList() where x.RunStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped select x).Count() > 0)
         {
             return(Amdocs.Ginger.CoreNET.Execution.eRunStatus.Stopped);
         }
         else if ((from x in gingerRunner.BusinessFlows.ToList()
                   where (x.RunStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed ||
                          x.RunStatus == Amdocs.Ginger.CoreNET.Execution.eRunStatus.Skipped)
                   select x).Count() == gingerRunner.BusinessFlows.Count)
         {
             return(Amdocs.Ginger.CoreNET.Execution.eRunStatus.Passed);
         }
         else
         {
             return(Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending);
         }
     }
     else if (gingerRunner != null)
     {
         return(gingerRunner.Status);
     }
     else
     {
         return(Amdocs.Ginger.CoreNET.Execution.eRunStatus.Pending);
     }
 }
 private async Task RunnerRunEndTask(GingerExecutionEngine gingerRunner)
 {
     AccountReportRunner accountReportRunner = AccountReportEntitiesDataMapping.MapRunnerEndData(gingerRunner.GingerRunner, mContext);
     await AccountReportApiHandler.SendRunnerExecutionDataToCentralDBAsync(accountReportRunner, true);
 }
Exemplo n.º 28
0
 public override void RunSetUpdate(LiteDB.ObjectId runSetLiteDbId, LiteDB.ObjectId runnerLiteDbId, GingerExecutionEngine gingerRunner)
 {
     return;
 }
Exemplo n.º 29
0
        public static List <AnalyzerItemBase> Analyze(GingerExecutionEngine GR, BusinessFlow BusinessFlow)
        {
            List <AnalyzerItemBase> IssuesList = new List <AnalyzerItemBase>();

            //code added to analyze for BFFlowControls in Runner BF.
            if (BusinessFlow.BFFlowControls.Count > 0)
            {
                foreach (FlowControl f in BusinessFlow.BFFlowControls)
                {
                    if (f.Active == true)
                    {
                        if (f.BusinessFlowControlAction == eBusinessFlowControlAction.GoToBusinessFlow)
                        {
                            string       GoToBusinessFlow = f.GetNameFromValue();
                            BusinessFlow bf           = null;
                            Guid         guidToLookBy = Guid.Empty;

                            if (!string.IsNullOrEmpty(f.GetGuidFromValue().ToString()))
                            {
                                guidToLookBy = Guid.Parse(f.GetGuidFromValue().ToString());
                            }

                            List <BusinessFlow> lstBusinessFlow = null;
                            if (guidToLookBy != Guid.Empty)
                            {
                                lstBusinessFlow = GR.BusinessFlows.Where(x => x.InstanceGuid == guidToLookBy).ToList();
                            }

                            if (lstBusinessFlow == null || lstBusinessFlow.Count == 0)
                            {
                                bf = null;
                            }
                            else if (lstBusinessFlow.Count == 1)
                            {
                                bf = (BusinessFlow)lstBusinessFlow[0];
                            }
                            else//we have more than 1
                            {
                                BusinessFlow firstActive = (BusinessFlow)lstBusinessFlow.Where(x => x.Active == true).FirstOrDefault();
                                if (firstActive != null)
                                {
                                    bf = firstActive;
                                }
                                else
                                {
                                    bf = (BusinessFlow)lstBusinessFlow[0];//no one is Active so returning the first one
                                }
                            }
                            if (bf == null)
                            {
                                AnalyzeRunnerBusinessFlow ABF = CreateNewIssue(IssuesList, GR, BusinessFlow);
                                ABF.Description = "Flow control is mapped to " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " which does not exist";
                                ABF.Details     = "'" + GoToBusinessFlow + "' " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " does not exist in the '" + GR.GingerRunner.Name + " ' " + GingerDicser.GetTermResValue(eTermResKey.RunSet);
                                ABF.HowToFix    = "Remap the Flow Control Action";
                                ABF.IssueType   = eType.Error;
                                ABF.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                ABF.Impact      = "Flow Control will fail on run time";
                                ABF.Severity    = eSeverity.High;
                            }
                        }
                        if (f.BusinessFlowControlAction == eBusinessFlowControlAction.SetVariableValue)
                        {
                            if (string.IsNullOrEmpty(f.Value) || ValueExpression.IsThisDynamicVE(f.Value) == false)
                            {
                                string   SetVariableValue = f.GetNameFromValue();
                                string[] vals             = SetVariableValue.Split(new char[] { '=' });
                                if ((BusinessFlow.GetAllHierarchyVariables().Where(x => x.Name == vals[0].Trim()).Select(x => x.Name).FirstOrDefault() == null))
                                {
                                    AnalyzeRunnerBusinessFlow ABF = CreateNewIssue(IssuesList, GR, BusinessFlow);
                                    ABF.Description = "Flow control mapped to " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " which does not exist";;
                                    ABF.Details     = "'" + vals[0].Trim() + "' " + GingerDicser.GetTermResValue(eTermResKey.Variable) + " does not exist in parent items";
                                    ABF.HowToFix    = "Remap the Flow Control Action";
                                    ABF.CanAutoFix  = AnalyzerItemBase.eCanFix.No;
                                    ABF.IssueType   = eType.Error;
                                    ABF.Impact      = "Flow Control will fail on run time";
                                    ABF.Severity    = eSeverity.High;
                                }
                            }
                        }
                    }
                }
            }

            IssuesList.AddRange(AnalyzeBusinessFlow.AnalyzeForMissingMandatoryInputValues(BusinessFlow));

            return(IssuesList);
        }
Exemplo n.º 30
0
        public void InitRunner(GingerRunner runner, GingerExecutionEngine ExecutorEngine)
        {
            //Configure Runner for execution
            runner.Status   = eRunStatus.Pending;
            runner.Executor = ExecutorEngine;
            ConfigureRunnerForExecution((GingerExecutionEngine)runner.Executor);

            //Set the Apps agents
            foreach (ApplicationAgent appagent in runner.ApplicationAgents.ToList())
            {
                if (appagent.AgentName != null)
                {
                    ObservableList <Agent> agents = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>();
                    appagent.Agent = (from a in agents where a.Name == appagent.AgentName select a).FirstOrDefault();
                }
            }

            //Load the biz flows
            ObservableList <BusinessFlow> runnerFlows = new ObservableList <BusinessFlow>();

            foreach (BusinessFlowRun businessFlowRun in runner.BusinessFlowsRunList.ToList())
            {
                ObservableList <BusinessFlow> businessFlows = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <BusinessFlow>();

                BusinessFlow businessFlow = (from x in businessFlows where x.Guid == businessFlowRun.BusinessFlowGuid select x).FirstOrDefault();
                //Fail over to try and find by name
                if (businessFlow == null)
                {
                    businessFlow = (from x in businessFlows where x.Name == businessFlowRun.BusinessFlowName select x).FirstOrDefault();
                }
                if (businessFlow == null)
                {
                    Reporter.ToLog(eLogLevel.ERROR, string.Format("Can not find the '{0}' {1} for the '{2}' {3}", businessFlowRun.BusinessFlowName, GingerDicser.GetTermResValue(eTermResKey.BusinessFlow), mRunSetConfig.Name, GingerDicser.GetTermResValue(eTermResKey.RunSet)));
                    continue;
                }
                else
                {
                    // Very slow
                    BusinessFlow BFCopy = (BusinessFlow)businessFlow.CreateCopy(false);

                    BFCopy.ContainingFolder = businessFlow.ContainingFolder;
                    BFCopy.Reset();
                    BFCopy.Active    = businessFlowRun.BusinessFlowIsActive;
                    BFCopy.Mandatory = businessFlowRun.BusinessFlowIsMandatory;
                    if (businessFlowRun.BusinessFlowInstanceGuid == Guid.Empty)
                    {
                        BFCopy.InstanceGuid = Guid.NewGuid();
                    }
                    else
                    {
                        BFCopy.InstanceGuid = businessFlowRun.BusinessFlowInstanceGuid;
                    }
                    if (businessFlowRun.BusinessFlowCustomizedRunVariables != null && businessFlowRun.BusinessFlowCustomizedRunVariables.Count > 0)
                    {
                        ObservableList <VariableBase> allBfVars = BFCopy.GetBFandActivitiesVariabeles(true);
                        Parallel.ForEach(businessFlowRun.BusinessFlowCustomizedRunVariables, customizedVar =>
                        {
                            //This is needed to handle updating the outputvariable mappedoutvalues to new style
                            UpdateOldOutputVariableMappedValues(customizedVar);

                            VariableBase originalVar = allBfVars.Where(v => v.ParentGuid == customizedVar.ParentGuid && v.Guid == customizedVar.Guid).FirstOrDefault();
                            if (originalVar == null)//for supporting dynamic run set XML in which we do not have GUID
                            {
                                originalVar = allBfVars.Where(v => v.ParentName == customizedVar.ParentName && v.Name == customizedVar.Name).FirstOrDefault();
                                if (originalVar == null)
                                {
                                    originalVar = allBfVars.Where(v => v.Name == customizedVar.Name).FirstOrDefault();
                                }
                            }
                            if (originalVar != null)
                            {
                                CopyCustomizedVariableConfigurations(customizedVar, originalVar);
                            }
                        });
                    }
                    AllPreviousBusinessFlowRuns.Add(businessFlowRun);
                    BFCopy.RunDescription = businessFlowRun.BusinessFlowRunDescription;
                    BFCopy.BFFlowControls = businessFlowRun.BFFlowControls;
                    runnerFlows.Add(BFCopy);
                }
            }

            runner.Executor.IsUpdateBusinessFlowRunList = true;
            runner.Executor.BusinessFlows = runnerFlows;
        }