/// <summary> /// When an exception occurs during a test case, this logs the stacktrace. /// This should only be called in the catch statement of a test. /// </summary> /// <param name="ex">The exception that occured</param> protected static void ReportException(Exception ex) { var currentTest = ExtentTestManager.GetTest(); var stacktrace = $"<br><br><b><i>Exception:</b></i><br>{ex.Message}<pre>{ex}</pre><b><i>Stacktrace:</b></i><pre>{Environment.StackTrace}</pre>"; currentTest.Log(stacktrace.Contains("Assert") ? LogStatus.Fail : LogStatus.Error, stacktrace); }
public void LogTearDown() { ExtentTestManager.EndTest(); }