Пример #1
0
        /// <summary>
        /// Converts the Ranorex Report into PDF after the test run completed. Use this module in
        /// the TearDown of your TestCase to ensure that it is executed even on failing test runs.
        /// </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 (!this.registered)
            {
                System.DateTime testSuiteCompleted = new System.DateTime();

                //PDF will be generated at the very end of the TestSuite
                TestSuite.TestSuiteCompleted += delegate
                {
                    testSuiteCompleted = System.DateTime.Now;
                    CreatePDF();
                };

#if !RX72 && !RX80 //this requires Ranorex 8.1+
                if (this.DeleteRanorexReport)
                {
                    TestSuiteRunner.TestRunCompleted += delegate
                    {
                        var cleaner = new CleanupRanorexReport(testSuiteCompleted);
                        cleaner.Cleanup();
                    };
                }
#endif

                this.registered = true;
            }
        }
Пример #2
0
        /// <summary>
        /// Converts the Ranorex Report into PDF after the test run completed. Use this module in
        /// the TearDown of your TestCase to ensure that it is executed even on failing test runs.
        /// </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 (!this.registered)
            {
                System.DateTime testSuiteCompleted = new System.DateTime();

                //PDF will be generated at the very end of the TestSuite
                TestSuite.TestSuiteCompleted += delegate
                {
                    testSuiteCompleted = System.DateTime.Now;

                    var currentTestSuiteName = TestSuite.Current.Name;

                    //Prevent redundant PDF conversion - required for multi test suite run
                    if (ReportToPDFModule.lastTestSuiteLogged != currentTestSuiteName)
                    {
                        CreatePDF();
                        ReportToPDFModule.lastTestSuiteLogged = currentTestSuiteName;
                    }
                };

                                #if !RX72 && !RX80 //this requires Ranorex 8.1+
                if (this.DeleteRanorexReport)
                {
                    TestSuiteRunner.TestRunCompleted += delegate
                    {
                        var cleaner = new CleanupRanorexReport(testSuiteCompleted);
                        cleaner.Cleanup();
                    };
                }
                                #endif

                this.registered = true;
            }
        }