Пример #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;

            //Get Windows AppData folder
            string tempLogFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            //This log file stores the number of failed scripts or testcases
            //Set initial value to 0
            SXCollections.WriteLogData(tempLogFolder + @"\script_error_count.log", "0");

            //This log file stores the number of all active testcases
            //Set initial value to 0
            SXCollections.WriteLogData(tempLogFolder + @"\script_count.log", "0");

            //This log file stores the duration of each testcase
            //Set initial value to 0
            SXCollections.WriteLogData(tempLogFolder + @"\script_duration.log", "0");

            //This log file stores the filename of the Ranorex compressed report
            //Set initial value to empty
            SXCollections.WriteLogData(tempLogFolder + @"\rxlogfile.log", "");
        }
Пример #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;

            //Get Windows AppData folder
            string tempLogFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            //Get the status of testcase
            string tcStatus = Ranorex.Core.Testing.TestSuite.Current.CurrentTestContainer.Status.ToString();

            //Get the total number of failed testcases
            int errorCount = Int32.Parse(System.IO.File.ReadAllText(tempLogFolder + @"\script_error_count.log"));

            //Get the current total number of testcases
            int scriptCount = Int32.Parse(System.IO.File.ReadAllText(tempLogFolder + @"\script_count.log"));

            scriptCount++;

            //If testcase fails
            if (tcStatus == "Failed")
            {
                Report.Failure("AUT State", "En testfeil har oppstått. System X må startes på nytt");
                errorCount++;

                //Restart System X if testcase fails
                TestTemplate.RestartSystemX.Start();
            }
            else
            {
                Report.Success("AUT State", "OK");
            }

            //Update the testcase error count
            SXCollections.WriteLogData(tempLogFolder + @"\script_error_count.log", errorCount.ToString());

            //Update the testcase count
            SXCollections.WriteLogData(tempLogFolder + @"\script_count.log", scriptCount.ToString());

            //Store the filename of the Ranorex report in the log file
            SXCollections.WriteLogData(tempLogFolder + @"\rxlogfile.log", Ranorex.Core.Reporting.TestReport.ReportEnvironment.ReportName);

            //Get the duration of the current testcase and store it in the log file
            string duration = Ranorex.Core.Reporting.TestReport.CurrentTestContainerActivity.ElapsedTime.ToString();

            SXCollections.WriteLogData(tempLogFolder + @"\script_duration.log", duration);
        }