示例#1
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";

            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);


            if (Host.Local.TryFindSingle <Ranorex.Button>(xPathCheckout, 2000, out btnCheckout))
            {
                Report.Log(ReportLevel.Info, "Mouse", "Clicking Checkout");
                btnCheckout.Click();
            }



            Global.CriteriaType = "Exit";

            Global.Proceed = false;
            TestModuleRunner.Run(V);

            TestReport.EndTestModule();
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
示例#2
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";

            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);

            string Select = Global.xelModule.Attribute("Select").Value;

            switch (Select)
            {
            case "Basic":
                break;

            case "Pro":
                break;

            case "Not Intrested":
                if (Host.Local.TryFindSingle <Ranorex.Text>(xPathNotIntrested, 2000, out txtPURSelection))
                {
                    Report.Log(ReportLevel.Info, "Mouse", "Clicking Not intrested");
                    txtPURSelection.Click();
                }
                break;

            case "Renew":
                break;

            default:
                break;
            }



            Global.CriteriaType = "Exit";

            Global.Proceed = false;
            TestModuleRunner.Run(V);

            TestReport.EndTestModule();
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
示例#3
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";

            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);

            string GPGSelect = Global.xelModule.Attribute("Select").Value;

            if (GPGSelect.ToLower() == "all")
            {
                if (Host.Local.TryFindSingle <Ranorex.Button>(xPathAddGPGAll, 2000, out btnAddGPGAll))
                {
                    Report.Log(ReportLevel.Info, "Mouse", "Clicking Add GPG to all items button");
                    btnAddGPGAll.Click();
                }
            }

            if (Host.Local.TryFindSingle <Ranorex.Button>(xPathGPGContinue, 2000, out btnGPGContinue))
            {
                Report.Log(ReportLevel.Info, "Mouse", "Clicking C ontinueAdd GPG to all items button");
                btnGPGContinue.Click();
            }


            if (!Global.Proceed)
            {
                TestReport.EndTestModule();
            }


            Global.CriteriaType = "Exit";

            Global.Proceed = false;
            TestModuleRunner.Run(V);

            TestReport.EndTestModule();
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
        /*
         * Path with 2 blocks/modules, successful
         */
        public TestResult Path1Usermethod()
        {
            TestReport.BeginTestCase("Flow1_Path1");

            TestResult testResult = TestResult.Skipped;

            try {
                TestReport.BeginTestModule("Flow1_Path1_Block1");
                // --- BEGIN ARD Blockcode ---
                Report.Info("Flow1 Path Block1");
                // --- END ARD Blockcode ---
                TestReport.EndTestModule();

                TestReport.BeginTestModule("Flow1_Path1_Block2");
                // --- BEGIN ARD Blockcode ---
                Report.Info("Flow1 Path Block2");
                // --- END ARD Blockcode ---
                TestReport.EndTestModule();

                testResult = TestResult.Passed;
            }
            catch (Exception e) {
                TestReport.EndTestModule();
                testResult = RanorexCoreReflectionHelper.HandleError(e);
                TestReport.SaveLocalScreenshotBuffer();
            }
            finally {
                TestReport.BeginTestCaseTeardown();

                try
                {
                    TestReport.BeginTestModule("Flow1_Path2_Teardown");
                    // --- BEGIN ARD Blockcode ---
                    Report.Info("There goes the successful Teardown");
                    // --- END ARD Blockcode ---
                    TestReport.EndTestModule();
                }
                catch (Exception e) {
                    TestReport.EndTestModule();
                    testResult = RanorexCoreReflectionHelper.HandleError(e);
                    TestReport.SaveLocalScreenshotBuffer();
                }
                finally
                {
                    TestReport.EndTestCaseTeardown();
                    TestReport.EndTestCase();
                }
            }
            return(testResult);
        }
示例#5
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";

            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);

            bool AddCustomer = Convert.ToBoolean(Global.xelModule.Attribute("AddCustomer").Value);

            if (!AddCustomer)
            {
                if (Host.Local.TryFindSingle <Ranorex.Button>(xPathDoNotInclude, 2000, out btnDoNotInclude))
                {
                    Report.Log(ReportLevel.Info, "Mouse", "Clicking Do Not Include");
                    btnDoNotInclude.Click();
                }
            }
            else
            {
                if (Host.Local.TryFindSingle <Ranorex.Text>(xPathFindCustomer, 2000, out txtFindCustomer))
                {
                    txtFindCustomer.Click();
                    FindCustomer mFindCustomer = new FindCustomer();
                    TestModuleRunner.Run(mFindCustomer);
                }
            }



            Global.CriteriaType = "Exit";

            Global.Proceed = false;
            TestModuleRunner.Run(V);

            TestReport.EndTestModule();
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
        /// <summary>
        /// The prepare reporting.
        /// </summary>
        /// <param name="executionObject">
        /// The execution object.
        /// </param>
        /// <param name="testSuite">
        /// The test suite.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool PrepareReporting(ExecutionObject executionObject, string testSuite)
        {
            Log.Enter(LogInfo.Namespace(MethodBase.GetCurrentMethod()), MethodBase.GetCurrentMethod().Name);

            if (!Directory.Exists(executionObject.ReportFolderOverview + @"\Temp"))
            {
                Directory.CreateDirectory(executionObject.ReportFolderOverview + @"\Temp");
            }

            TestReport.Setup(ReportLevel.Debug, executionObject.ReportPathAndFileOverviewTemp, true);
            TestReport.BeginTestSuite(testSuite, executionObject.DtmStudioTestData.DeviceTypeProject.FDTDeviceTypeName);
            TestReport.BeginTestCase(testSuite, string.Empty);
            TestReport.BeginTestModule("Details");

            return(true);
        }
        /*
         * Path with 1 block/module, fails in the block/module itself
         */
        public TestResult Path1Usermethod()
        {
            TestReport.BeginTestCase("Flow2_Path1");

            TestResult testResult = TestResult.Skipped;

            try {
                TestReport.BeginTestModule("Flow2_Path1_Block1");
                // --- BEGIN ARD Blockcode ---
                Report.Info("Flow2 Path Block1");
                Validate.IsTrue(false);
                // --- END ARD Blockcode ---
                TestReport.EndTestModule();

                testResult = TestResult.Passed;
            }
            catch (Exception e) {
                TestReport.EndTestModule();
                testResult = RanorexCoreReflectionHelper.HandleError(e);
                TestReport.SaveLocalScreenshotBuffer();
            }
            finally {
                TestReport.BeginTestCaseTeardown();

                try
                {
                    TestReport.BeginTestModule("Flow2_Path1_Teardown");
                    // --- BEGIN ARD Blockcode ---
                    Report.Info("And our teardown does its job");
                    Validate.IsTrue(true);
                    // --- END ARD Blockcode ---
                    TestReport.EndTestModule();
                }
                catch (Exception e) {
                    TestReport.EndTestModule();
                    testResult = RanorexCoreReflectionHelper.HandleError(e);
                    TestReport.SaveLocalScreenshotBuffer();
                }
                finally
                {
                    TestReport.EndTestCaseTeardown();
                    TestReport.EndTestCase();
                }
            }
            return(testResult);
        }
示例#8
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;
            try
            {
                String _strPathRegionalWorkFlowSheet = filePath + "\\TestData\\BindingAuthority_Testdata.xlsx";
                //Ranorex.Controls.ProgressForm.Hide();
                //Read Driver Data sheet

                //TestDataFilePath = GetSheetPath(strEntityName);
                string timestamp = System.DateTime.Now.ToString("yyyyMMdd") + "_" + System.DateTime.Now.ToString("hhmmss");

                //Report Enviornment Setup
                ReportClass.ReportSetup("BindingAuthority", ResultFolderPath, timestamp);

                //Read Driver Data sheet
                DataTable dt = DataReader.ReadMyExcel(_strPathRegionalWorkFlowSheet, "Driver_BindingAuthority");
                //DataReader.EmptyReRun(TestDataFilePath,"Driver_BindingAuth$");

                //Read each Row in Driver_Project
                foreach (DataRow dr in dt.Rows)
                {
                    Dictionary <string, string> drDriverData = DataReader.LoadData(dr);

                    //Read Row needs to be executed TestCaseName
                    if (drDriverData["Execute"] == "Y")
                    {
                        //--------------------------Test Suite Start
                        TestReport.BeginTestSuite("Binding Authority", "Comment");
                        //--------------------------Start Test Case
//						TestReport.BeginTestCase(drDriverData["TestCaseNo"] +" - " + drDriverData["TestCaseName"]);
                        DataTable dtTestData = new DataTable();

                        //Read Rows from Test Data Sheet and get Test Script row count
                        dtTestData = DataReader.ReadMyExcel(_strPathRegionalWorkFlowSheet, drDriverData["DataSheet"]);
                        DataRow[] filteredRows = dtTestData.Select("TestCaseName='" + drDriverData["TestCaseName"] + "'");
                        foreach (DataRow testdatadr in filteredRows)
                        {
                            Dictionary <string, string> drTestData = DataReader.LoadData(testdatadr);
                            int iterationcount = Int32.Parse(drTestData["Iteration"]);
                            int itcount        = 1;
                            if (iterationcount > 1)
                            {
//								String test="Testing";
//								ActivityExecType act= ActivityExecType.RunIteration;
//								TestEntryActivityType tactivty=TestEntryActivityType.TestCase;
                                for (int j = 1; j <= iterationcount; j++)
                                {
                                    //ReportClass.errorValue = 0;

//									TestReport.BeginTestContainer(itcount,test,act,tactivty);
//									TestReport.BeginTestCase(drTestData["TestCaseName"],test);
                                    //TestReport.
                                    TestReport.BeginTestModule(drDriverData["TestCaseName"]);
                                    TestModuleRunner.Run(callTestCase(drDriverData["TestCaseName"], drTestData));
                                    TestReport.EndTestModule();
                                    //	TestReport.EndTestEntryContainer();
//									TestReport.EndTestCase();
                                    itcount++;
                                }
                            }
                            else
                            {
                                if (iterationcount == 1)
                                {
                                    //ReportClass.errorValue = 0;
                                    TestReport.BeginTestModule(drDriverData["TestCaseName"]);
                                    TestModuleRunner.Run(callTestCase(drDriverData["TestCaseName"], drTestData));
//									TestReport.EndTestModule();
//									if(reRun)
//										DataReader.UpdateExcelFile(TestDataFilePath,"Driver_RegionalWorkflow","TestCaseName",drDriverData["TestCaseName"],"ReRun","Y");
                                }
                            }
                        }
                        //End Test Case
//						TestReport.EndTestCase();
                    }
                }

//				//Read each Row in Driver_Project
//				foreach (DataRow dr in dt.Rows)
//				{
//					Dictionary<string,string> drDriverData= DataReader.LoadData(dr);
//
//					//Read Row needs to be executed TestCaseName
//					if(drDriverData["ReRun"]=="Y")
//					{
//						//--------------------------Test Suite Start
//						TestReport.BeginTestSuite("Regional WorkFlow","Comment");
//						//--------------------------Start Test Case
//						TestReport.BeginTestCase(drDriverData["TestCaseName"]);
//						DataTable dtTestData = new DataTable();
//
//						//Read Rows from Test Data Sheet and get Test Script row count
//						dtTestData= DataReader.ReadMyExcel(_strPathRegionalWorkFlowSheet,drDriverData["DataSheet"]);
//						DataRow[] filteredRows =  dtTestData.Select("TestCaseName='"+drDriverData["TestCaseName"]+"'");
//						foreach (DataRow testdatadr in filteredRows)
//						{
//							Dictionary<string,string> drTestData = DataReader.LoadData(testdatadr);
//							TestReport.BeginTestModule(drDriverData["TestCaseName"]);
//							TestModuleRunner.Run(ApplicationFunctions.callTestCase(drDriverData["TestCaseName"],drTestData));
//							TestReport.EndTestModule();
//						}
//						//End Test Case
//						TestReport.EndTestCase();
//					}
//				}
            }
            catch (Exception ex)
            {
                Report.Failure("Exception Occured :", ex.Message);
            }
        }
示例#9
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            string SKU  = "";
            string DEPT = "";
            string ESRB = "";
            int    QTY  = 0;
            bool   GPG;


            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";

            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);


            if (!Global.Proceed)
            {
                TestReport.EndTestModule();
            }

            try
            {
                SKU = Global.xelModule.Attribute("SKU").Value;
            }
            catch {}

            try
            {
                DEPT = Global.xelModule.Attribute("DEPT").Value;
            }
            catch {}
            try
            {
                ESRB = Global.xelModule.Attribute("ESRB").Value;
            }
            catch {}
            try
            {
                QTY = Convert.ToInt32(Global.xelModule.Attribute("QTY").Value);
            }
            catch {}
            try
            {
                GPG = Convert.ToBoolean(Global.xelModule.Attribute("QTY").Value);
            }
            catch {}


            for (int i = 0; i < QTY; i++)
            {
                if (Host.Local.TryFindSingle <Ranorex.Button>(xPathPurchase, 2000, out btnPurchase))
                {
                    Report.Log(ReportLevel.Info, "Mouse", "Click on 'Purchases'.");
                    btnPurchase.Click();

                    if (Host.Local.TryFindSingle <Ranorex.Text>(xpathAddItem, 2000, out txtAddItem))
                    {
                        Report.Log(ReportLevel.Info, "Keyboard", "Enter SKU followed by the Enter key.");
                        txtAddItem.PressKeys(SKU + "{Return}");
                        Delay.Milliseconds(1000);
                    }
                }
            }


            Global.CriteriaType = "Exit";

            Global.Proceed = false;
            TestModuleRunner.Run(V);

            TestReport.EndTestModule();
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
        /*
         * Path with 1 block/module, automates notepad and then fails in the teardown
         */
        public TestResult Path2Usermethod()
        {
            TestReport.BeginTestCase("Flow1_Path2");

            TestResult testResult = TestResult.Skipped;

            try {
                TestReport.BeginTestModule("Flow1_Path2_Block1");
                // --- BEGIN ARD Blockcode  ---
                Report.Info("Flow1 Path2 Block1 (only block)");
                Report.Info("This is it!");
                Delay.Milliseconds(200);
                Report.Info("This is it!");
                Delay.Milliseconds(200);

                var start = repo.Explorer.Start;
                start.MoveTo();

                // copied from NotepadTest
                Report.Log(ReportLevel.Info, "Application", "Run application 'C:\\Windows\\System32\\notepad.exe' with arguments '' in normal mode.");
                Host.Local.RunApplication("C:\\Windows\\System32\\notepad.exe", "", "C:\\Windows\\System32", false);

                Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'UntitledNotepad.Text15' at 254;96.", repo.UntitledNotepad.Text15Info);
                repo.UntitledNotepad.Text15.Click("254;96");

                Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'aaa' with focus on 'UntitledNotepad.Text15'.", repo.UntitledNotepad.Text15Info);
                repo.UntitledNotepad.Text15.PressKeys("aaa");

                Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'UntitledNotepad.Edit' at 21;17.", repo.UntitledNotepad.EditInfo);
                repo.UntitledNotepad.Edit.Click("21;17");

                Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'Notepad.UndoCtrlPlusZ' at 35;6.", repo.Notepad.UndoCtrlPlusZInfo);
                repo.Notepad.UndoCtrlPlusZ.Click("35;6");

                Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'UntitledNotepad.File' at 5;14.", repo.UntitledNotepad.FileInfo);
                repo.UntitledNotepad.File.Click("5;14");

                Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'Notepad.Exit' at 34;13.", repo.Notepad.ExitInfo);
                repo.Notepad.Exit.Click("34;13");
                // --- END ARD Blockcode ---
                TestReport.EndTestModule();

                testResult = TestResult.Passed;
            }
            catch (Exception e) {
                TestReport.EndTestModule();
                testResult = RanorexCoreReflectionHelper.HandleError(e);
                TestReport.SaveLocalScreenshotBuffer();
            }
            finally {
                TestReport.BeginTestCaseTeardown();

                try
                {
                    TestReport.BeginTestModule("Flow1_Path2_Teardown");
                    // --- BEGIN ARD Blockcode ---
                    Report.Info("And our teardown blows off");
                    Validate.IsTrue(false);
                    // --- END ARD Blockcode ---
                    TestReport.EndTestModule();
                }
                catch (Exception e) {
                    TestReport.EndTestModule();
                    testResult = RanorexCoreReflectionHelper.HandleError(e);
                    TestReport.SaveLocalScreenshotBuffer();
                }
                finally
                {
                    TestReport.EndTestCaseTeardown();
                    TestReport.EndTestCase();
                }
            }
            return(testResult);
        }
示例#11
0
文件: Login.cs 项目: joeyrodrigue/PAL
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 100;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;
            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";


            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);

            if (!Global.Proceed)
            {
                TestReport.EndTestModule();
            }

            string strUsername = "";
            string strPassword = "";

            try
            {
                strUsername = Global.xelModule.Attribute("username").Value;
                strPassword = Global.xelModule.Attribute("password").Value;
            }
            catch
            {}

            //string strRegisterIni = "c:\\pos\\register.ini";
            IniFile iniRegister = new IniFile(Global.strRegisterIni);
            string  strStatus   = iniRegister.IniReadValue("Terminal", "Status");

            strStatus = strStatus.ToLower();

            Global.stwStepStopWatch      = new Stopwatch();
            Global.stwIterationStopWatch = new Stopwatch();

            //Start the time
            Global.stwStepStopWatch.Start();
            Global.stwIterationStopWatch.Start();



            if (strStatus == "open")
            {
                if (!Host.Local.TryFindSingle <Ranorex.Text>(xPathTxtUserID, 100, out txtUserId))
                {
                    Host.Local.TryFindSingle <Ranorex.Button>(xPathPressF5ToStartANewTransaction, 2000, out btnNewTransaction);
                    Report.Log(ReportLevel.Info, "Mouse", "Click on 'PressF5ToStartANewTransaction'.");
                    btnNewTransaction.Click();
                }
            }


            if (Host.Local.TryFindSingle <Ranorex.Text>(xPathTxtUserID, 2000, out txtUserId))
            {
                Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'psu' with focus on 'TxtUserId'.");
                txtUserId.PressKeys(strUsername);
            }


            if (Host.Local.TryFindSingle <Ranorex.Text>(xPathTxtPassword, 2000, out txtPassword))
            {
                Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'advanced' with focus on 'TxtPassword'.");
                txtPassword.PressKeys(strPassword);

                Report.Log(ReportLevel.Info, "Keyboard", "Key sequence '{Return}' with focus on 'TxtPassword'.");
                txtPassword.PressKeys("{Return}");
            }

            Global.CriteriaType = "Exit";
            Global.Proceed      = false;

            TestModuleRunner.Run(V);

            Global.stwStepStopWatch.Stop();
            Global.logger.Add(1, Global.intIteration, Global.strID, this.GetType().Name, Global.stwStepStopWatch.Elapsed);
            if (Global.Proceed)
            {
                TestReport.EndTestModule();
            }
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
示例#12
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            TestReport.BeginTestModule(this.GetType().Name);
            Global.xdocModule   = XDocument.Load(@"C:\PAL\Automation\Modules\" + this.GetType().Name + ".config");
            Global.CriteriaType = "Entrance";

            Global.Proceed = false;
            Verify V = new Verify();

            TestModuleRunner.Run(V);

            string TenderAmount = "";
            string BalanceDue   = "";
            string Tender       = Global.xelModule.Attribute("Tender").Value;

            if (Host.Local.TryFindSingle <Ranorex.Text>(xPathBalanceDue, 2000, out txtBalanceDue))
            {
                BalanceDue = txtBalanceDue.TextValue.Replace("$", "");
            }

            if (Host.Local.TryFindSingle <Ranorex.Text>(xPathCash, 2000, out txtCash))
            {
                Report.Log(ReportLevel.Info, "Mouse", "Clicking Cash");
                txtCash.Click();
            }

            if (Host.Local.TryFindSingle <Ranorex.Text>(xPathAmountPaid, 2000, out txtAmountPaid))
            {
                switch (Tender)
                {
                case "Exact":
                    TenderAmount = BalanceDue;
                    break;

                case "Split w/ Credit Prompt":

                    break;

                case "Split":

                    break;

                case "Over":

                    break;

                default:
                    break;
                }

                Report.Log(ReportLevel.Info, "Keyboard", "Typing " + TenderAmount + " and a Return in AmountPaid");
                txtAmountPaid.PressKeys(TenderAmount + "{Return}");
            }


            Validate.Exists(xPathChangeDue, 5000, "Change Due Prompt Displayed", false);

            GamestopAutomationRepository repo = GamestopAutomationRepository.Instance;

            RepoItemInfo ChangeDueInfo = new RepoItemInfo(repo, "ChangeDue", xPathChangeDue, 30000, null);

            ChangeDueInfo.WaitForNotExists(30000);

            //Validate.NotExists(xPathChangeDue,10000,"Change Due Prompt Closed",false);


            Global.CriteriaType = "Exit";

            Global.Proceed = false;
            TestModuleRunner.Run(V);

            TestReport.EndTestModule();
            if (!Global.Proceed)
            {
                TestReport.EndTestCase(TestResult.Failed);
            }
        }
示例#13
0
 /// <summary>
 /// Begins the test module.
 /// </summary>
 /// <param name="testCaseModule">The test case module.</param>
 public static void BeginTestModule(string testCaseModule)
 {
     TestReport.BeginTestModule(testCaseModule);
 }
示例#14
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;
            try
            {
                string testCaseName;

                string timestamp = System.DateTime.Now.ToString("yyyyMMdd") + "_" + System.DateTime.Now.ToString("hhmmss");

                //Read Driver Data sheet
                DataTable dt         = DataReader.ReadMyExcel(TestDataFilePath, "Driver_RanorexDemo");
                DataTable dtTestData = new DataTable();
                //Report Envirnment Setup
                ReportClass.ReportSetup("RanorexDemo", ResultFolderPath, timestamp);
                Ranorex.Controls.ProgressForm.Show();
                if (envDetails == "")
                {
                    //Read each Row in Driver_ClaimsCenter
                    foreach (DataRow dr in dt.Rows)
                    {
                        Dictionary <string, string> drDriverData = DataReader.LoadData(dr);

                        //Read Row needs to be executed
                        if (drDriverData["Execute"] == "Y")
                        {
                            testCaseName = drDriverData["TestCaseName"];
                            //--------------------------Test Suite Start
                            TestReport.BeginTestSuite("Ranorex Demo", "Comment");
                            //--------------------------Start Test Case
                            TestReport.BeginTestCaseContainer(testCaseName);
                            int iterationcount = Int32.Parse(drDriverData["Iteration"]);
                            int itcount        = 1;

                            //Read Rows from Test Data Sheet and get Test Script row count
                            dtTestData = DataReader.ReadMyExcel(TestDataFilePath, drDriverData["DataSheet"]);
                            DataRow[] filteredRows = dtTestData.Select("TestCaseNo='" + drDriverData["TestCaseNo"] + "'");
                            Dictionary <string, string> drTestData = DataReader.LoadData(filteredRows[0]);
                            //------------------------------Start individual Script iteration
                            if (iterationcount > 1)
                            {
                                String                test     = "Testing";
                                ActivityExecType      act      = ActivityExecType.RunIteration;
                                TestEntryActivityType tactivty = TestEntryActivityType.TestCase;
                                for (int j = 1; j <= iterationcount; j++)
                                {
                                    TestReport.BeginTestEntryContainer(j, test, act, tactivty);
//										(drDriverData["TestCaseName"],j,test,act,tactivty);
                                    TestReport.BeginTestModule(testCaseName);
                                    TestModuleRunner.Run(callTestCase(drDriverData["TestCaseName"], drTestData));
                                    TestReport.EndTestModule();
                                    TestReport.EndTestEntryIterationContainer();
                                    itcount++;
                                }
                            }
                            else
                            {
                                if (iterationcount == 1)
                                {
                                    TestReport.BeginTestModule(testCaseName);
                                    TestModuleRunner.Run(callTestCase(drDriverData["TestCaseName"], drTestData));
                                    TestReport.EndTestModule();
                                }
                            }
                            //End Test Case
                            TestReport.EndTestCaseContainer();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Report.Failure(ex.Message);
            }
        }
示例#15
0
        /// <summary>
        /// The prepare reporting.
        /// </summary>
        /// <param name="executionObject">
        /// The execution object.
        /// </param>
        /// <returns>
        /// The <see cref="string"/>.
        /// </returns>
        public static string PrepareReporting(ref ExecutionObject executionObject)
        {
            Log.Enter(LogInfo.Namespace(MethodBase.GetCurrentMethod()), MethodBase.GetCurrentMethod().Name);
            if (!Directory.Exists(executionObject.ReportFolderTestCases))
            {
                Directory.CreateDirectory(executionObject.ReportFolderTestCases);
            }

            var currentDateAndTime = DateTime.Now.ToString("yyyyMMdd_HHmmss");

            // currentTestCase contains the current testcase namen + date-time-stamp
            currentTestCase = currentDateAndTime + "_" + executionObject.TestCaseName;

            // filename contains the whole path
            // it´s number of characters must be less then 255-5 (5 from .data by creating the file)
            var fileName            = executionObject.ReportFolderTestCases + @"\" + currentTestCase;
            var testCasePathAndFile = fileName + executionObject.FileExtension; // originFileName;

            // check path length of all parts
            // Check path length for creating ranorex report
            // if ranorexReportLength > 92
            //   shorten name of ranorex report
            //   log info about shortening ranorexReport
            // if completePathLength > 250
            //   shorten name of ranorex report
            //   log info about shortening ranorexReport
            // if shortenig is not enought
            //   log info about ranorexReport which wont be available due path length issues
            try
            {
                string testSuiteName = executionObject.CurrentTestReportInfo.TestSuiteName;

                // Check currentTestCase length if filename is too long for ranorex setup function.
                // If filename is too long, cut of characters for valid number of characters.
                int currentTestCaseLength = currentTestCase.Length;
                if (currentTestCaseLength > ConstLenghts.MaxFileLengthByRanorex)
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("TestCaseName [" + currentTestCase + "] has more than " + ConstLenghts.MaxFileLengthByRanorex + " (" + currentTestCaseLength.ToString(CultureInfo.InvariantCulture) + ") characters and has been reduced to a valid length.");
                    Console.ResetColor();

                    currentTestCase       = currentTestCase.Remove(ConstLenghts.MaxFileLengthByRanorex, currentTestCaseLength - ConstLenghts.MaxFileLengthByRanorex);
                    testCasePathAndFile   = executionObject.ReportFolderTestCases + @"\" + currentTestCase + executionObject.FileExtension;
                    currentTestCaseLength = currentTestCase.Length;
                }

                // Check reportFileName length if path is too long for file system.
                // If filename is too long and if it is possible to cut of characters from currentTestCase filename
                // cut of characters for valid number of characters.
                int reportFileNameLength = testCasePathAndFile.Length;

                if (reportFileNameLength > ConstLenghts.MaxPathLengthForTempararyPostfix)
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("ReportFileName [" + testCasePathAndFile + "] has more than " + (ConstLenghts.MaxPathLengthByOperatingSystem - 1) + " (" + testCasePathAndFile.Length + ") characters.");
                    Console.ResetColor();

                    int availableCharacters = ConstLenghts.MaxPathLengthForTempararyPostfix - reportFileNameLength + currentTestCaseLength;

                    // Shorten currentTestCase name to the length of available characters
                    if (availableCharacters - DateTimeLength - executionObject.FileExtension.Length > 0)
                    {
                        currentTestCase      = currentTestCase.Remove(availableCharacters, currentTestCaseLength - availableCharacters);
                        testCasePathAndFile  = executionObject.ReportFolderTestCases + @"\" + currentTestCase + executionObject.FileExtension;
                        reportFileNameLength = testCasePathAndFile.Length;
                    }
                    else
                    {
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.WriteLine("ReportFileName [" + testCasePathAndFile + "] could not be trimmed. There are less characters left for a filename with a length of one character + file extension.");
                        Console.ResetColor();
                    }
                }

                if (reportFileNameLength > ConstLenghts.MaxPathLengthForTempararyPostfix)
                {
                    // Create Report Object
                    executionObject.CurrentTestCaseInfo.TestCaseName   = currentTestCase + ": The TestCaseReport [" + currentTestCase + "] is not available due to exceeded path length = " + testCasePathAndFile.Length.ToString(CultureInfo.InvariantCulture) + ".";
                    executionObject.CurrentTestCaseInfo.TestCasePath   = string.Empty;
                    executionObject.CurrentTestCaseInfo.TestCaseResult = TestResult.Failed;
                    executionObject.CurrentTestReportInfo.TestCaseInfos.Add(executionObject.CurrentTestCaseInfo);
                }
                else
                {
                    TestReport.Setup(ReportLevel.Debug, testCasePathAndFile, true);
                    TestReport.BeginTestSuite(executionObject.CurrentTestCase.DisplayName, testSuiteName);
                    TestReport.BeginTestCase(executionObject.CurrentTestCase.DisplayName);
                    TestReport.BeginTestModule("Details");

                    string backToOverview = FileNameHandler.GetRelativePathToOverview(executionObject.ReportFolderOverview, executionObject.ReportFolderTestCases);
                    backToOverview = backToOverview + @"\" + executionObject.ReportNameOverview;

                    Report.LogHtml(ReportLevel.Debug, string.Empty, @"<a href='" + backToOverview + "'>" + @"Back to Overview" + "</a>");
                }
            }
            catch (Exception exception)
            {
                Log.Enter(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message);
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine(LogInfo.Namespace(MethodBase.GetCurrentMethod()) + ": " + exception.Message);
                Console.ResetColor();
            }

            return(testCasePathAndFile);
        }