// #################################################### private void DoScenarioLooping() { RanorexRepository repo = new RanorexRepository(); fnGetEndTime GetEndTime = new fnGetEndTime(); fnGetStartTime GetStartTime = new fnGetStartTime(); fnPlayWavFile PlayWavFile = new fnPlayWavFile(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); fnDumpStats DumpStats = new fnDumpStats(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); // Backoffice fnDoScenario13 DoScenario13 = new fnDoScenario13(); fnDoScenario14 DoScenario14 = new fnDoScenario14(); fnDoScenario15 DoScenario15 = new fnDoScenario15(); fnDoScenario18 DoScenario18 = new fnDoScenario18(); fnDoScenario19 DoScenario19 = new fnDoScenario19(); fnDoScenario20 DoScenario20 = new fnDoScenario20(); fnDoScenario21 DoScenario21 = new fnDoScenario21(); // Retech fnDoScenario16 DoScenario16 = new fnDoScenario16(); fnDoScenario33 DoScenario33 = new fnDoScenario33(); fnDoScenario34 DoScenario34 = new fnDoScenario34(); fnDoScenario36 DoScenario36 = new fnDoScenario36(); fnDoScenario37 DoScenario37 = new fnDoScenario37(); fnDoScenario38 DoScenario38 = new fnDoScenario38(); fnDoScenario41 DoScenario41 = new fnDoScenario41(); fnDoScenario42 DoScenario42 = new fnDoScenario42(); fnDoScenario43 DoScenario43 = new fnDoScenario43(); fnDoScenario47 DoScenario47 = new fnDoScenario47(); // Other fnDoScenario50 DoScenario50 = new fnDoScenario50(); fnUpdateItemMDB UpdateItemMDB = new fnUpdateItemMDB(); Global.LogText = "RUN STARTED - IN fnDoScenarios Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); // Decide if limited by number of iterations or time if (Global.IterationsToDo != -1) { // not equal to zero is based on number of iterations Global.StopByTime = false; } else { // equal to -1 means drive by stop time Global.StopByTime = true; } Global.DoDumpStats = false; Global.CurrentScenario = 0; Global.RetechScenariosPerformed = 0; if (Global.RegisterNumber == "1") { Global.LogText = "Updating SKU quantities"; WriteToLogFile.Run(); Global.SQLCommand = "update sku set Qty = 999999 where Qty < 5000"; UpdateItemMDB.Run(); } // If Scenario 37 Reserve Pickup then turn flag off for all SKUs EnforceStreetDate if (Global.DoScenarioFlag[37] && Global.RegisterNumber == "1") { Global.LogText = "Setting all EnforceStreetDates to false"; WriteToLogFile.Run(); Global.SQLCommand = "update sku set EnforceStreetDate = false where EnforceStreetDate = true"; UpdateItemMDB.Run(); Global.LogText = "Setting all IsStreetDateOverridden to true"; WriteToLogFile.Run(); Global.SQLCommand = "update sku set IsStreetDateOverridden = true where IsStreetDateOverridden = false"; UpdateItemMDB.Run(); } // ########## Start the main scenario looping here ########## do { GetStartTime.Run(); // Get Scenario start time InitScenarioStart(); DoScenario13.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario14.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario15.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario16.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario18.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario19.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario20.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario21.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario33.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario34.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario36.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario37.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario38.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario41.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario42.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario43.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario47.Run(); EndScenarioCleanup(); InitScenarioStart(); DoScenario50.Run(); EndScenarioCleanup(); GetEndTime.Run(); // Get Scenario end time // Dump stats for all scenarios to the stats file Global.CurrentScenario = 0; if (Global.DoDumpStats) { DumpStats.Run(); } Global.CurrentIteration++; // See if time to quit if (!Global.LoopingDone) { if (!Global.StopByTime) { if (Global.CurrentIteration > Global.IterationsToDo) { Global.LoopingDone = true; } } else { System.DateTime DateTimeNow = System.DateTime.Now; string TimeToStopExecution = Global.TimeToStopExecution; int CommaOffset = TimeToStopExecution.IndexOf(","); if (CommaOffset != -1) { TimeToStopExecution = Global.TimeToStopExecution.Substring(0, CommaOffset); } int TimeUp = System.DateTime.Compare(DateTimeNow, Convert.ToDateTime(TimeToStopExecution)); if (TimeUp > 0) { Global.LoopingDone = true; } } } Global.IterationsToday++; // PAL Status Monitor UpdatePALStatusMonitor.Run(); Global.LogText = "Next Iteration"; WriteToLogFile.Run(); } while (!Global.LoopingDone); Global.WavFilePath = "Register" + Global.RegisterNumber + "Finished.wav"; PlayWavFile.Run(); Global.LogText = "RUN FINISHED - OUT fnDoScenarios Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); }
public void Run() { Mouse.DefaultMoveTime = 300; Keyboard.DefaultKeyPressTime = 100; Delay.SpeedFactor = 1.0; RanorexRepository repo = new RanorexRepository(); fnUpdatePALStatusMonitor UpdatePALStatusMonitor = new fnUpdatePALStatusMonitor(); fnWriteToLogFile WriteToLogFile = new fnWriteToLogFile(); FnWriteOutStatsQ4Buffer WriteOutStatsQ4Buffer = new FnWriteOutStatsQ4Buffer(); fnDumpStatsQ4 DumpStatsQ4 = new fnDumpStatsQ4(); fnTimeMinusOverhead TimeMinusOverhead = new fnTimeMinusOverhead(); fnWriteToErrorFile WriteToErrorFile = new fnWriteToErrorFile(); FnCommon14and15 CommonScenario14and15 = new FnCommon14and15(); fnDumpStats DumpStats = new fnDumpStats(); //Ranorex.Unknown element = null; Global.AbortScenario = false; //*****************Start Scenario 15 - Shift-F12 Performance Summary ****************** Global.CurrentScenario = 15; if (!Global.IndirectCall) { if (!Global.DoScenarioFlag[Global.CurrentScenario]) // if(Global.CurrentScenario != 9999) { return; } } if (Global.CombinedIPOS) { repo.GoToBackOffice.Click(); Thread.Sleep(200); } // Create new stopwatch Stopwatch MystopwatchTT = new Stopwatch(); MystopwatchTT.Reset(); MystopwatchTT.Start(); Stopwatch MystopwatchModuleTotal = new Stopwatch(); MystopwatchModuleTotal.Reset(); MystopwatchModuleTotal.Start(); Stopwatch MystopwatchQ4 = new Stopwatch(); Global.LogText = @"---> fnDoScenario15 Iteration: " + Global.CurrentIteration; WriteToLogFile.Run(); Report.Log(ReportLevel.Info, "Scenario 15 IN", "Iteration: " + Global.CurrentIteration, new RecordItemIndex(0)); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'IPOS270141HomeScreen.Element1' at 269;333.", repo.BackOffice275111HomeScreen.BackOffice275111HomeScreenInfo, new RecordItemIndex(0)); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Clicking on Back Office link"; WriteToLogFile.Run(); repo.BackOffice275111HomeScreen.BackOffice275111HomeScreen.Click(); Global.LogText = @"Waiting for Back Office home screen"; WriteToLogFile.Run(); while (!repo.BackOffice275111HomeScreen.BackOffice275111HomeScreen.Enabled) { Thread.Sleep(100); } TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Load Back Office"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); repo.BackOffice275111HomeScreen.Self.Click(); Global.LogText = @"Clicking Shift-F12 Performance Summary"; WriteToLogFile.Run(); Keyboard.Press("{LShiftKey down}{F12}{LShiftKey up}"); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Waiting for UserID to be enabled"; WriteToLogFile.Run(); while (!repo.ShellRoot.TxtUserId.Enabled) { Thread.Sleep(100); } Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = "Load Dashboard login"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); Global.LogText = @"Log into Back Office"; WriteToLogFile.Run(); repo.ShellRoot.TxtUserId.TextValue = "psu"; repo.ShellRoot.TxtPassword.TextValue = "advanced"; Keyboard.Press("{Return}"); Global.TempFloat = (float)MystopwatchQ4.ElapsedMilliseconds / 1000; TimeMinusOverhead.Run((float)MystopwatchQ4.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Log in"; Global.Module = "Dashboard:"; DumpStatsQ4.Run(); MystopwatchQ4.Reset(); MystopwatchQ4.Start(); while (1 == 1) { Global.CurrentScenario = 15; // 11-30-18 MystopwatchTT.Reset(); MystopwatchTT.Start(); Global.IterationsToday++; // PAL Status Monitor Global.RetechScenariosPerformed++; UpdatePALStatusMonitor.Run(); CommonScenario14and15.Run(); TimeMinusOverhead.Run((float)MystopwatchTT.ElapsedMilliseconds); // Subtract overhead and store in Global.Q4StatLine Global.CurrentMetricDesciption = @"Scenario 15 Loop"; Global.Module = "Total Time"; DumpStatsQ4.Run(); // Write out metrics buffer WriteOutStatsQ4Buffer.Run(); // Dump stats for all scenarios to the stats file Global.CurrentScenario = 0; if (Global.DoDumpStats) { DumpStats.Run(); } Global.CurrentIteration++; } // ***********End Scenario 15***************** }