internal static void RunGuitest( string methodTestName, ExecuteTestDelegate testDelegate) { mRunTestLog.Info("0 stage"); // Here you can prepare some options for the test, // setup configuration files or clean old ones to make sure the // test runs in a reproducible scenario. RunTest(methodTestName, testDelegate, GetGuiTestExecutablePath()); }
static void RunTest( string methodTestname, ExecuteTestDelegate testDelegate, string binariesPath) { mRunTestLog.Info("1 stage"); InitLog(methodTestname); string testName = PNUnitServices.Get().GetTestName(); try { mRunTestLog.Info("2 stage"); PNUnitServices.Get().SetInfoOSVersion(GetOSVersion()); mRunTestLog.Info("Before GetTestParams"); string[] testParams = PNUnitServices.Get().GetTestParams(); mRunTestLog.Info("Before InitBarriers"); PNUnitServices.Get().InitBarriers(); mRunTestLog.Info("3 stage"); EnterBarrier(PNUnitServices.Get().GetTestStartBarrier()); mRunTestLog.Info("4 stage"); if (PlatformUtils.CurrentPlatform == PlatformUtils.Platform.Linux) { CheckMonoLibraries(binariesPath); CheckMonoLibraries(Assembly.GetExecutingAssembly().Location); } mRunTestLog.Info("5 stage"); string actualTestName = GetCleanTestName(testName); testDelegate?.Invoke(GetCleanTestName(testName)); } catch (Exception ex) { LogTestException(methodTestname, testName, ex); throw; } finally { EnterBarrier(PNUnitServices.Get().GetTestEndBarrier()); } }
internal static void RunTest( string methodTestname, ExecuteTestDelegate testDelegate) { RunGuitest(methodTestname, testDelegate); // In this example we do not throw any unhandled exception, but in // the case the application does, it would end up being handled here. Exception unhandledException = GuiTesteableServices.UnhandledException; if (unhandledException != null) { Assert.Fail( "The test finished with an unhandled exception: {1}{0}{2}", Environment.NewLine, unhandledException.Message, unhandledException.StackTrace); } CheckUnexpectedMessages(); }