Esempio n. 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;

            LxSetup mainOp    = LxSetup.getInstance();
            string  tsName    = mainOp.getTestCaseName();
            string  excelPath = "keywordscripts/" + tsName + ".xlsx";

            Report.Info("INfo", excelPath);

            mainOp.StrExcelDirve = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(),
                                                          excelPath);
            mainOp.runApp();                                                    //  ********* 1. run Application *********

            LxParse stepsRepository = mainOp.getSteps();
            // stepsRepository.doValidate();                //  ********* 2. check scripts  syntax *********

            ArrayList stepList = stepsRepository.getStepsList();
            bool      result   = LxGenericAction.performScripts(stepList); //  ********* 3. run scripts with reflection *********

            mainOp.setResult();

            mainOp.runOverOneCase(tsName);
            mainOp.opXls.close();
            LxTearDown.closeApp(mainOp.ProcessId);              //  ********* 4. clean up for next running *********
        }
Esempio n. 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;

            LxSetup mainOp         = LxSetup.getInstance();
            var     configs        = mainOp.configs;
            string  RestoreDB_Flag = configs["RestoreDB_AfterEachTestCase"];

            BackupDB(RestoreDB_Flag);

            string tsName    = mainOp.getTestCaseName();
            string excelPath = "keywordscripts/" + tsName + ".xlsx";

            Report.Info("INfo", excelPath);
            mainOp.StrExcelDirve = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(),
                                                          excelPath);
            mainOp.runApp();                                                    //  ********* 1. run Application *********

            LxParse stepsRepository = mainOp.getSteps();
            // stepsRepository.doValidate();                //  ********* 2. check scripts  syntax *********
            ArrayList stepList = stepsRepository.getStepsList();
            bool      result   = LxGenericAction.performScripts(stepList); //  ********* 3. run scripts with reflection *********

            mainOp.setResult();
            mainOp.runOverOneCase(tsName);
            mainOp.opXls.close();
            Delay.Seconds(5);
            LxTearDown.closeApp(mainOp.ProcessId);              //  ********* 4. clean up for next running *********

            RestoreDB(RestoreDB_Flag);
            if (!result)
            {
                throw new Ranorex.ValidationException("The test case running failed!", null);
            }
        }
Esempio n. 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;
            LxSetup mainOp  = LxSetup.getInstance();
            var     configs = mainOp.configs;

            string DetailSteps   = AppConfigOper.mainOp.getConfigValue("DetailSteps_InResult");
            string strUserName   = AppConfigOper.mainOp.getConfigValue("UserName");
            string strPassword   = AppConfigOper.mainOp.getConfigValue("Password");
            string strServerName = AppConfigOper.mainOp.getConfigValue("ServerName");

            BackupDB();

            string tsName      = mainOp.getTestCaseName();
            string excelPath   = "keywordscripts/" + tsName + ".xlsx";
            string keywordName = "keywordscripts/";

            Report.Info("INfo", excelPath);

            mainOp.StrExcelDirve = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(),
                                                          excelPath);
            mainOp.m_strUserName   = strUserName;
            mainOp.m_stPassword    = strPassword;
            mainOp.m_strServerName = strServerName;

            mainOp.runApp();//  ********* 1. run Application *********

            //Copy script to Report folder
            string reportPath = Program.getReport();
            string sourcePath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(),
                                                       keywordName);

            string  reprotFileName  = reportPath + tsName + ".xlsx";
            string  sourceFileName  = mainOp.StrExcelDirve;
            LxParse stepsRepository = mainOp.getSteps();
            // stepsRepository.doValidate();                //  ********* 2. check scripts  syntax *********

            int       myProcess = mainOp.ProcessId;
            ArrayList stepList  = stepsRepository.getStepsList();
            bool      result    = true;

            //  ********* 3. run scripts with reflection *********
            try
            {
                result = LxGenericAction.performScripts(stepList, DetailSteps);
            }
            catch (Exception e)
            {
                result = false;
                LxLog.Error("Error", tsName + " " + e.Message.ToString());
            }

            mainOp.setResult();
            mainOp.runOverOneCase(tsName);
            mainOp.opXls.close();
            Delay.Seconds(5);
            LxTearDown.closeApp(mainOp.ProcessId);              //  ********* 4. clean up for next running *********

            RestoreDB();

            // Add excel file link in Ranorex.report.
            string linkFile = reportPath + tsName + ".xlsx";
            string html     = String.Format("<a href='{0}'>{1}</a>", linkFile, tsName);

            Report.LogHtml(ReportLevel.Info, "Info", html);

            //Copy all report created by Ranorex to Nform Report folder.
//          XCopy(sourcePath, reportPath);
            System.IO.File.Copy(sourceFileName, reprotFileName, true);

            if (!result)
            {
                throw new Ranorex.ValidationException("The test case running failed!", null);
            }
        }