Example #1
0
        public static void Start()
        {
            TestReport.EndTestModule();

            var    reportFileDirectory = TestReport.ReportEnvironment.ReportFileDirectory;
            var    name  = TestReport.ReportEnvironment.ReportName;
            string input = String.Format(@"{0}\{1}.rxlog.junit.xml", reportFileDirectory, name);

            if (!File.Exists(input))
            {
                Report.Log(ReportLevel.Error, "Unable to find file: " + input);
            }

            if (File.ReadAllText(input).Length == 0)
            {
                Report.Log(ReportLevel.Success, "Test müde, Test schlafen!");
                Thread.Sleep(10000);
            }

            byte[] text = File.ReadAllBytes(input);     //File.ReadAllText(input);
            byte[] b    = new byte[text.Length - 3];

            for (int i = 0; i < b.Length; i++)
            {
                b[i] = text[i + 3];
            }

            Report.Log(ReportLevel.Success, text.Length.ToString());
            File.WriteAllBytes(input.Replace(".rxlog.junit.xml", ".rxlog.junit.xml"), b);
            Report.Log(ReportLevel.Success, "Junit test fixed");
        }
Example #2
0
        /// <summary>
        /// The finish reporting.
        /// </summary>
        /// <param name="executionObject">
        /// The execution object.
        /// </param>
        /// <param name="testCaseInfo">
        /// The test Case Info.
        /// </param>
        public static void FinishReporting(ref ExecutionObject executionObject, ref TestCaseInfo testCaseInfo)
        {
            Log.Enter(LogInfo.Namespace(MethodBase.GetCurrentMethod()), MethodBase.GetCurrentMethod().Name);

            try
            {
                testCaseInfo.TestCaseName   = currentTestCase; // executionObject.TestCaseName;
                testCaseInfo.TestCasePath   = executionObject.ReportFolderTestCases;
                testCaseInfo.TestCaseResult = (TestResult)TestReport.CurrentTestModuleActivity.Status;
                executionObject.CurrentTestReportInfo.TestCaseInfos.Add(testCaseInfo);

                // Finish testcase logfile
                TestReport.EndTestModule();
                TestReport.SetCurrentTestResult(testCaseInfo.TestCaseResult);
                TestReport.EndTestCase();
                TestReport.SetCurrentTestResult(testCaseInfo.TestCaseResult);
                TestReport.EndTestCaseSetup();
                TestReport.SetCurrentTestResult(testCaseInfo.TestCaseResult);
                TestReport.SaveReport();
                TestReport.Clear();
            }
            catch (Exception exception)
            {
                Log.Enter(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message);
            }
        }
Example #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);


            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);
            }
        }
Example #4
0
        private void FinishTestReport()
        {
            if (ActivityStack.Current is TestSuiteActivity)
            {
                TestReport.EndTestModule();
                Report.End();
            }

            TestReport.SaveReport();
        }
        /// <summary>
        /// Logs all collected error messages to the "After Test Suite" section of the Ranorex report
        /// </summary>
        private static void LogErrorMessages(object sender, EventArgs e)
        {
            // End report
            TestReport.EndTestModule();

            // Report collected error messages
            foreach (var message in errorMessages)
            {
                Report.Info("RetryError", message);
            }
        }
        /// <summary>
        /// Logs all collected error messages to the After Test Suite section of the Ranorex report
        /// </summary>
        private void LogErrorMessages()
        {
            //End report
            TestReport.EndTestModule();

            //Report collected error messages
            foreach (var message in CollectErrorMessagesModule.builder)
            {
                Report.Info(message);
            }
        }
Example #7
0
        private void FinishTestReport()
        {
            Activity activity = ActivityStack.Current;

            if (activity.GetType().Name.Equals("TestSuiteActivity"))
            {
                TestReport.EndTestModule();
                Report.End();
            }

            TestReport.SaveReport();
        }
Example #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;

            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);
            }
        }
Example #9
0
        private void FinishReport()
        {
            Activity activity = ActivityStack.Current;

            //Necessary to end the Ranorex Report in order to update the duration and finalize the status
            if (activity.GetType().Name.Equals("TestSuiteActivity"))
            {
                TestReport.EndTestModule();
                Report.End();
            }

            TestReport.SaveReport();
        }
Example #10
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);
        }
        /// <summary>
        /// The finish execution.
        /// </summary>
        /// <param name="testResult">
        /// The test Result.
        /// </param>
        public static void FinishReporting(TestResult testResult)
        {
            Log.Enter(LogInfo.Namespace(MethodBase.GetCurrentMethod()), MethodBase.GetCurrentMethod().Name);

            // Finish testcase logfile
            TestReport.EndTestModule();
            TestReport.SetCurrentTestResult(testResult);
            TestReport.EndTestCase();
            TestReport.SetCurrentTestResult(testResult);
            TestReport.EndTestCaseSetup();
            TestReport.SetCurrentTestResult(testResult);
            TestReport.SaveReport();
            TestReport.Clear();
        }
Example #13
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);
            }
        }
        /*
         * 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);
        }
Example #15
0
        private string ConvertReportToPDF(string pdfName, string xml, string details)
        {
            //Necessary to end the Ranorex Report in order to update the duration and finalize the status
            TestReport.EndTestModule();
            Report.End();

            var zippedReportFileDirectory = CreateTempReportFileDirectory();
            var reportFileDirectory       = TestReport.ReportEnvironment.ReportFileDirectory;
            var name = TestReport.ReportEnvironment.ReportName;

            var input             = String.Format(@"{0}\{1}.rxzlog", zippedReportFileDirectory, name);
            var PDFReportFilePath = String.Format(@"{0}\{1}", reportFileDirectory, AddPdfExtension(pdfName));

            TestReport.SaveReport();
            Report.Zip(TestReport.ReportEnvironment, zippedReportFileDirectory, name);

            Ranorex.PDF.Creator.CreatePDF(input, PDFReportFilePath, xml, details);
            return(PDFReportFilePath);
        }
Example #16
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()
        {
            //Delegate must be registered only once
            if (!registered)
            {
                //PDF will be generated at the very end of the testsuite
                TestSuite.TestSuiteCompleted += delegate {
                    //Specify report name if not already set
                    if (String.IsNullOrEmpty(this.PDFName))
                    {
                        this.PDFName = CreatePDFName();
                    }

                    //Necessary to end the testreport in order to update the duration
                    TestReport.EndTestModule();

                    //Comment out if ConvertReportToPDF() is called directly
                    try
                    {
                        Report.LogHtml(ReportLevel.Success, "PDFReport", "Successfully created PDF: <a href='" + ConvertReportToPDF(PDFName, xml, details) + "' target='_blank'>Open PDF</a>");
                    }
                    catch (Exception e)
                    {
                        Console.BackgroundColor = ConsoleColor.Black;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("ReportToPDF: " + e.Message);
                        Console.ResetColor();
                        Console.WriteLine("Press any key to continue...");
                        Console.ReadKey();
                    }

                    //Delete *.rxzlog if not enabled within test suite settings
                    Cleanup();

                    //Update error value
                    UpdateError();
                };

                registered = true;
            }
        }
Example #17
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()
        {
            if (!registered)
            {
                TestSuite.TestSuiteCompleted += delegate {
                    TestReport.EndTestModule();

                    var    reportFileDirectory = TestReport.ReportEnvironment.ReportFileDirectory;
                    var    name  = TestReport.ReportEnvironment.ReportName;
                    string input = String.Format(@"{0}\{1}.rxlog.junit.xml", reportFileDirectory, name);

                    if (!File.Exists(input))
                    {
                        Report.Log(ReportLevel.Error, "Unable to find file: " + input);
                    }

                    int j = 0;

                    while (File.ReadAllText(input).Length == 0 && j < 10)
                    {
                        Report.Log(ReportLevel.Success, "Test müde, Test schlafen!");
                        Thread.Sleep(5000);
                        j++;
                    }

                    byte[] text = File.ReadAllBytes(input); //File.ReadAllText(input);
                    byte[] b    = new byte[text.Length - 3];

                    for (int i = 0; i < b.Length; i++)
                    {
                        b[i] = text[i + 3];
                    }

                    Report.Log(ReportLevel.Success, text.Length.ToString());
                    File.WriteAllBytes(input.Replace(".rxlog.junit.xml", ".rxlog.junit_fixed.xml"), b);
                    Report.Log(ReportLevel.Success, "Junit test fixed");
                };

                registered = true;
            }
        }
Example #18
0
        private void OnTestSuiteCompletedSendResult(object sender, EventArgs e)
        {
            var currentTestSuiteStatus = TestReport.CurrentTestSuiteActivity;
            var zippedReportFile       = string.Empty;

            if (bool.Parse(this.SendZippedReportOnComplete))
            {
                //Necessary to end the Ranorex Report in order to update the duration and finalize the status
                TestReport.EndTestModule();
                Report.End();

                // zip the current report
                var zippedReportFileDirectory = TestReport.ReportEnvironment.ReportFileDirectory;
                var name = TestReport.ReportEnvironment.ReportName;

                TestReport.SaveReport();

                Report.Zip(TestReport.ReportEnvironment, zippedReportFileDirectory, name);
                Report.Info("Zipped report has been generated.");
                zippedReportFile = string.Format("{0}\\{1}.rxzlog", zippedReportFileDirectory, TestReport.ReportEnvironment.ReportName);
            }

            if ((bool.Parse(this.SendEmailOnFailure) && currentTestSuiteStatus.Status == ActivityStatus.Failed) ||
                (bool.Parse(this.SendEmailOnSuccess) && currentTestSuiteStatus.Status == ActivityStatus.Success) ||
                (bool.Parse(this.SendZippedReportOnComplete) && !bool.Parse(this.SendEmailOnFailure) && !bool.Parse(this.SendEmailOnSuccess)))
            {
                EmailLibrary.SendEmail(
                    this.Subject,
                    this.To,
                    this.From,
                    this.Body,
                    zippedReportFile,
                    this.ServerHostname,
                    int.Parse(this.ServerPort),
                    bool.Parse(this.UseSSL),
                    this.Username,
                    this.Password);
            }
        }
Example #19
0
 /// <summary>
 /// Ends the test module.
 /// </summary>
 public static void EndTestModule()
 {
     TestReport.EndTestModule();
 }
Example #20
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);
            }
        }
Example #21
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);
            }
        }
Example #22
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);
        }
Example #24
0
        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);
            }
        }
Example #25
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);
            }
        }