예제 #1
0
 public CashlinxLoadThreadController(
     ProgressionRate pRate,
     uint delayUsers,
     uint maxThreads,
     double scale,
     uint numIters,
     LoadTestInputVO input,
     ThreadPriority priority,
     ExecuteFlow scen,
     MsgFunction mFunc,
     StreamWriter fOutput)
 {
     this.rate = pRate;
     this.delayBetweenUsers = delayUsers;
     this.maxNumberThreads  = maxThreads;
     this.threadRateList    = new List <uint>();
     this.threadList        = new List <Thread>();
     this.threadPriority    = priority;
     this.progressionScale  = scale;
     this.numberIterations  = numIters;
     this.flowToExecute     = scen;
     this.threadInput       = input;
     this.msgFunction       = mFunc;
     if (this.progressionScale < 0.0d)
     {
         this.progressionScale *= -1.0d;
     }
     this.genThreadRateList();
     this.prepareThreads();
     this.fullyComplete = false;
     this.curIteration  = 0;
     this.timings       = new Dictionary <int, List <TupleType <int, string, double> > >();
     this.fileOutput    = fOutput;
     this.fileOutput.WriteLine("Iteration,  ThreadID  ,  Area  , Duration (seconds) ");
 }
예제 #2
0
        public bool ExecuteNewPawnLoanFlow(LoadTestInputVO loadVo)
        {
            if (!this.initialized || loadVo == null)
            {
                return(false);
            }

            try
            {
                var menuNav = new List <string>()
                {
                    "PawnButton", "NewPawnLoanButton"
                };
                while (!this.NavigateMenu(menuNav))
                {
                    Thread.Sleep(THD_DELAY);
                }

                List <Window> windows = this.desktopApp.GetWindows();
                if (CollectionUtilities.isEmpty(windows))
                {
                    throw new ApplicationException("Cannot retrieve the child windows");
                }
                //Lookup customer form
                Window lookupWindow = windows.Last();
                if (lookupWindow == null)
                {
                    throw new ApplicationException("Cannot find lookup customer window");
                }
                bool success;
                var  lookupLastName = TryRetrieveComponent <TextBox>(lookupWindow, "lookupCustomerLastName", NUM_TRIES, out success);
                bool success2;
                var  lookupFirstName = TryRetrieveComponent <TextBox>(lookupWindow, "lookupCustomerFirstName", NUM_TRIES, out success2);
                bool success3;
                var  findButton = TryRetrieveComponent <Button>(lookupWindow, "lookupCustomerFindButton", NUM_TRIES, out success3);
                if (!success || !success2 || !success3)
                {
                    throw new ApplicationException("Cannot retrieve input fields or find button");
                }
                lookupLastName.BulkText  = loadVo.LastName;
                lookupFirstName.BulkText = loadVo.FirstName;
                findButton.Click();
                //Sleep for one second for results to be loaded from the database
                Thread.Sleep(1000);

                windows = this.desktopApp.GetWindows();
                int cnt = 0;
                while (CollectionUtilities.isEmpty(windows) && cnt++ < NUM_TRIES)
                {
                    Thread.Sleep(THD_DELAY);
                }

                Window lookupResults = windows.Last();
                if (lookupResults == null)
                {
                    throw new ApplicationException("Cannot find lookup customer results window");
                }

                bool success4;
                var  findDataGrid = TryRetrieveComponent <Table>(
                    lookupResults, "lookupCustomerResultsGrid", NUM_TRIES, out success4);

                if (!success4)
                {
                    throw new ApplicationException("Cannot access data grid in lookup customer results window");
                }

                //Click the select button
                findDataGrid.Rows[0].Cells[0].Click();
            }
            catch (Exception eX)
            {
                MessageBox.Show("Application exception: " + eX.Message);
            }
            finally
            {
                this.KillApplication();
            }


            return(true);
        }