Beispiel #1
0
        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");
            BaseValues.ExtentReports.AttachReporter(htmlReporter);
        }
Beispiel #2
0
        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();
        }