public static void CreateReport() { if (EXTENT_REPORT == null) { Utilitarios.EnsureDirectoryExists(reportRootPath); Utilitarios.EnsureDirectoryExists(reportPath); var htmlReporter = new ExtentV3HtmlReporter(fullReportFilePath); htmlReporter.LoadConfig(Utilitarios.GetProjectPath() + "extent-config.xml"); EXTENT_REPORT = new ExtentReports(); EXTENT_REPORT.AttachReporter(htmlReporter); } }
public static ExtentReports InitializeExtentReport(string htmlExtentReportFileName) { extent = new ExtentReports(); string dateTimeStamp = DateTime.Now.ToString("_D-MMddyyyy_T-HHmmss"); string path = System.Reflection.Assembly.GetCallingAssembly().CodeBase; string actualPath = path.Substring(0, path.LastIndexOf("bin")); string projectPath = new Uri(actualPath).LocalPath; string htmlReportFilePath = Path.Combine(projectPath + "TestOutput", htmlExtentReportFileName + dateTimeStamp + ".html"); string extentConfigFilePath = Path.Combine(projectPath + "Config", "Extent-Config.xml"); htmlReporter = new ExtentV3HtmlReporter(htmlReportFilePath); extent = new ExtentReports(); extent.AttachReporter(htmlReporter); htmlReporter.LoadConfig(extentConfigFilePath); return(extent); }
public ExtentReports InitialiseExtentReports() { extentFolder.Value = ".\\Logs\\" + DateTime.Now.ToString("yyyyMMdd"); date = DateTime.Now.ToString("yyyyMMddHHmmss"); // extentFolder.Value = extentReportBaseFolder + "\\" + date + "\\"; var di = Directory.CreateDirectory(extentFolder.Value); // initialize the HtmlReporter // var htmlReporter = new ExtentHtmlReporter(extentFolder.Value + "\\" + date + ".html"); var htmlReporter = new ExtentV3HtmlReporter(extentFolder.Value + "\\" + date + ".html"); htmlReporter.LoadConfig("extent-config.xml"); extent = new ExtentReports(); extent.AttachReporter(htmlReporter); return(extent); }
public static ExtentV3HtmlReporter InitializeReport(string reportName) { var reportsDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Reports"); if (!Directory.Exists(reportsDirectory)) { Directory.CreateDirectory(reportsDirectory); } var reportsFilename = $"{reportName}_{DateTime.Now:yyyyMMdd_HHmmss}_{Properties.Test.Default.AzureCalculatorPath}.html"; var reportsPath = Path.Combine(reportsDirectory, reportsFilename); var v3HtmlReporter = new ExtentV3HtmlReporter(reportsPath); v3HtmlReporter.LoadConfig(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "reports_config.xml")); return(v3HtmlReporter); }
public ExtentReportsHelper() { //To create time stamp for unique report names string day = DateTime.Today.ToString("dddd"); string year = DateTime.Now.Year.ToString("0000"); string month = DateTime.Now.Month.ToString("00"); string date = DateTime.Now.Day.ToString("00"); string hour = DateTime.Now.Hour.ToString("00"); string minute = DateTime.Now.Minute.ToString("00"); string second = DateTime.Now.Second.ToString("00"); string timestamp2 = hour + minute + second + "_" + date + month + "_" + year; //var timestamp = DateTime.Now.ToFileTime();//to get timestamp for unique file names each time //var timestamp1= DateTime.Now.Date+DateTime.Now.TimeOfDay; //reporter = new ExtentV3HtmlReporter(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Reports/ExtentReports.html")); extent = new ExtentReports(); //have to change the path to relative one //reporter = new ExtentV3HtmlReporter("C:/Users/dtdev/csharp/csharp/sampletest/Reports/ExtentReports"+"_"+timestamp2+".html"); //reporter.LoadConfig("C:/Users/dtdev/csharp/csharp/sampletest/Configs/extent-config.xml"); reporter = new ExtentV3HtmlReporter(ConfigurationManager.AppSettings["ReportsPath"] + "/" + ConfigurationManager.AppSettings["AppUnderTest"] + "_" + timestamp2 + ".html"); reporter.LoadConfig("C:/Users/dtdev/csharp/csharp/sampletest/Utilities/Configs/extent-config.xml"); //sampletest\Utilities\Configs\extent-config.xml //below lines would have been needed in case we did not have seperate config file //reporter.Config.DocumentTitle = "Sample Automation Testing Report 1"; //reporter.Config.ReportName = "Regression Testing Suite 1"; //reporter.Config.Theme = AventStack.ExtentReports.Reporter.Configuration.Theme.Dark;//to set different themes //need to paramterize this below section as well extent.AttachReporter(reporter); extent.AddSystemInfo("App Under Test", ConfigurationManager.AppSettings["AppUnderTest"]); extent.AddSystemInfo("Environment", ConfigurationManager.AppSettings["Environment"]); extent.AddSystemInfo("Machine", Environment.MachineName); extent.AddSystemInfo("OS", Environment.OSVersion.VersionString); extent.AddSystemInfo("Browser", ConfigurationManager.AppSettings["BrowserName"]); }