public void AttachScreenshot(string path) { string relativePath; if (path.Contains(Config.GetOutputDir())) { relativePath = path.Replace(Config.GetOutputDir() + @"\", ""); } else { var fileName = Path.GetFileName(path); const string relativeDir = "extentScreenshots"; var newPath = Path.Combine(Config.GetOutputDir(), relativeDir); Directory.CreateDirectory(newPath); File.Copy(path, Path.Combine(newPath, fileName)); relativePath = Path.Combine(relativeDir, fileName); } _test.AddScreenCaptureFromPath(relativePath); }
private ExtentHtmlReporter() { var htmlReporter = new AventStack.ExtentReports.Reporter.ExtentHtmlReporter(Path.Combine(Config.GetOutputDir(), "extent.html")); htmlReporter.LoadConfig("Extent-Config.xml"); Extent.AttachReporter(htmlReporter); }