public static void Wrap(Action action, IExceptionLogInfoResolver exceptionLogInfoResolver = null)
 {
     try
     {
         action.Invoke();
     }
     catch (Exception ex)
     {
         Handle(ex, exceptionLogInfoResolver);
     }
 }
예제 #2
0
 public static void Wrap(Action action, IExceptionLogInfoResolver exceptionLogInfoResolver = null)
 {
     try
     {
         action.Invoke();
     }
     catch (Exception ex)
     {
         Handle(ex, exceptionLogInfoResolver);
     }
 }
        public static string Handle(Exception ex, IExceptionLogInfoResolver extraLogInfoResolver = null)
        {
            Debug.WriteLine(ex.Message);
            Debug.WriteLine(ex.InnerException);
            Debug.WriteLine(ex.StackTrace);
            var fileName = FileName();

            File.WriteAllText(fileName + ".txt",
                "-- Resolved URL: " + ScenarioFixture.Instance.ResolveHostAndPort() + Environment.NewLine +
                "-- Actual URL: " + ScenarioFixture.Instance.Driver.Url + Environment.NewLine +
                "-- Exception Message: " + ex.Message + Environment.NewLine +
                "-- Stacktrace: " + Environment.NewLine + ex.StackTrace + Environment.NewLine + Environment.NewLine +
                "-- Service log: " + Environment.NewLine + (extraLogInfoResolver ?? new NoLogInfoResolver()).ReadLog());

            RemoteWebDriver().GetScreenshot().SaveAsFile(fileName + ".png", ImageFormat.Png);

            PrintExceptions();

            return fileName;
        }
예제 #4
0
        public static string Handle(Exception ex, IExceptionLogInfoResolver extraLogInfoResolver = null)
        {
            Debug.WriteLine(ex.Message);
            Debug.WriteLine(ex.InnerException);
            Debug.WriteLine(ex.StackTrace);
            var fileName = FileName();

            File.WriteAllText(fileName + ".txt",
                "-- Resolved URL: " + ScenarioFixture.Instance.ResolveHostAndPort() + Environment.NewLine +
                "-- Actual URL: " + ScenarioFixture.Instance.Driver.Url + Environment.NewLine +
                "-- Exception Message: " + ex.Message + Environment.NewLine +
                "-- Stacktrace: " + Environment.NewLine + ex.StackTrace + Environment.NewLine + Environment.NewLine +
                "-- Service log: " + Environment.NewLine + (extraLogInfoResolver ?? new NoLogInfoResolver()).ReadLog());

            RemoteWebDriver().GetScreenshot().SaveAsFile(fileName + ".png", ScreenshotImageFormat.Png);

            PrintExceptions();

            return fileName;
        }