public void CloseTest() { test = extent.CreateTest(TestContext.CurrentContext.Test.Name); if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Passed) { test.Log(Status.Pass, "Test Sucessful"); test.AddScreenCaptureFromPath(TakeScreenshot.TakeScreenshotMethod(driver, "SearchLocationTestMethod")); test.Pass(MarkupHelper.CreateLabel(TestContext.CurrentContext.Test.Name, ExtentColor.Green)); } else if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed) { test.Log(Status.Fail, "Test Failed"); test.AddScreenCaptureFromPath(TakeScreenshot.TakeScreenshotMethod(driver, "SearchLocationTestMethod")); test.Pass(MarkupHelper.CreateLabel(TestContext.CurrentContext.Test.Name, ExtentColor.Green)); } // Closes all the connections to the extend reports extent.Flush(); }