public static void BeforeTestRun() { CleanUpAllDriver(); BaseDriver.StartBrowser(BrowserType.Chrome); // Create the folder report DateTime now = DateTime.Now; var dirReport = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Report " + now.ToString("ddd dd-MMM-yyyy HH-mm-ss/"); var htmlReporter = new ExtentHtmlReporter(dirReport); htmlReporter.LoadConfig(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\extent-config.xml"); // Klov*************** BaseValues.KlovReport.InitMongoDbConnection("127.0.0.1", 27017); // URL of the KLOV server BaseValues.KlovReport.InitKlovServerConnection("http://127.0.0.1:5689"); BaseValues.KlovReport.ProjectName = "Extent Report - Klov"; BaseValues.KlovReport.ReportName = "Test results " + DateTime.Now.ToString(); try { BaseValues.ExtentReports.AttachReporter(BaseValues.KlovReport, htmlReporter); } catch (TimeoutException) { throw new TimeoutException("Please check the connection to Mongo DB server. A timeout occured after 30s selecting a server using CompositeServerSelector"); } }
public void ClassCleanup() { // Runs once after all tests in this class are executed. (Optional) // Not guaranteed that it executes instantly after all tests from the class. var status = TestContext.CurrentContext.Result.Outcome.Status; if (status == TestStatus.Failed && ExtentReportsHelper.GetTest() == null) { ExtentReportsHelper.CreateTest(TestContext.CurrentContext.Test.Name); ExtentReportsHelper.LogFail(null, "Test Fail."); } BaseValues.ExtentReports.Flush(); // Disppose the instance of webdriver BaseDriver.StopBrowser(); CleanUpAllDriver(); }
protected TestFixture() { CleanUpAllDriver(); BaseDriver.StartBrowser(BrowserType.Chrome); // Create the folder report DateTime now = DateTime.Now; var dirReport = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Report " + now.ToString("ddd dd-MMM-yyyy HH-mm-ss/"); var htmlReporter = new ExtentHtmlReporter(dirReport); htmlReporter.LoadConfig(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\extent-config.xml"); // Klov*************** BaseValues.KlovReport.InitMongoDbConnection("localhost", 27017); // URL of the KLOV server BaseValues.KlovReport.InitKlovServerConnection("http://localhost:5689"); BaseValues.KlovReport.ProjectName = "Extent Report - Klov"; BaseValues.KlovReport.ReportName = "Test results " + DateTime.Now.ToString(); BaseValues.ExtentReports.AttachReporter(BaseValues.KlovReport, htmlReporter); }