public TestException(string scenarioName, LogType logType, string info, string screenshotFileName = null) { LogHelper.WriteToLog("Test Scenario Name: " + scenarioName, logType); LogHelper.WriteToLog(info, logType); if (screenshotFileName != null) { string screenshotFilePath = BrowserScreenshot.CaptureBrowserScreenshot(screenshotFileName); LogHelper.WriteToLog("Screenshot added to loaction : " + screenshotFilePath, logType); TestContext.WriteLine("Screenshot added to loaction : " + screenshotFilePath); } //Write to Nunit Test Context so that it can be written to Nunit TestReprt.xml TestContext.WriteLine(info); }
public void OnTearDown() { try { var driver = _objectContainer.Resolve <RemoteWebDriver>(); BrowserScreenshot.Get(driver, GetType().Name); Logger.Write($"Closing window at: {driver.Url}"); driver.QuitDriver(); } catch (Exception e) { Logger.Write(e); } }
public static void WriteToLog(string message, CustomLogType logType, string addtionalInfo, string screenShotFileName) { switch (Settings.TestLogTarget) { case LogTarget.Log4Net: if (logger is null) { logger = new LogFourNetManager(); } logger.Log(message, logType, addtionalInfo); string screenshotFilePath = BrowserScreenshot.CaptureBrowserScreenshot(screenShotFileName); logger.Log("Screenshot added to loaction : " + screenshotFilePath, logType); break; case LogTarget.Text: break; default: break; } }