Пример #1
0
 public void LogStep(StepInfo stepInfo, string prefix)
 {
     if (ConfigurationManager.AppSettings["step.screenshot"].Contains("true"))
     {
         testInstance.Log(Status.Pass, prefix + " " + FormatUtils.formatCamelCaseText(stepInfo.StepDefinitionType + stepInfo.Text));
         testInstance.AddScreenCaptureFromPath(generateScreenshot());
     }
     else
     {
         testInstance.Log(Status.Pass, prefix + " " + FormatUtils.formatCamelCaseText(stepInfo.StepDefinitionType + stepInfo.Text));
     }
 }
Пример #2
0
        private string generateScreenshot()
        {
            itemCount++;
            Screenshot ss        = ((ITakesScreenshot)webdriver).GetScreenshot();
            string     timeStamp = FormatUtils.GetTimestamp(DateTime.Now);

            String shotName     = ScenarioContext.Current.ScenarioInfo.Title + "-" + itemCount + "-" + timeStamp + ".png";
            String shotNamePath = System.IO.Path.Combine(Constants.ReportPath, @shotName);

            ss.SaveAsFile(shotNamePath, ScreenshotImageFormat.Png);

            return(shotNamePath);
        }
Пример #3
0
        private void SetReportsConfiguration()
        {
            if (extentReports == null)
            {
                //init Reports
                //htmlReports = new ExtentHtmlReporter(Constants.ExtentReportFile);
                htmlReports = new ExtentHtmlReporter(Thread.CurrentThread.ManagedThreadId + "-" + FormatUtils.GetTimestamp(DateTime.Now) + "-" + Constants.ExtentReportFile);

                //THERE IS A BUG IN EXTENTREPORTS - when fixed multiple test threads will be able to aggregate in a single report
                htmlReports.AppendExisting = true;
                extentReports = new ExtentReports();

                extentReports.AttachReporter(htmlReports);

                htmlReports.Configuration().ReportName    = "PoC x PRMA " + DateTime.Now;
                htmlReports.Configuration().DocumentTitle = "PRMA Test Report";
                //htmlReports.Configuration().Theme = Theme.Dark;
            }
        }