Пример #1
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();
        }
Пример #2
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");

            // 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);

            //BaseValues.ExtentReports.AttachReporter(htmlReporter);
        }