无法在Selenium Java中生成扩展数据块报告
我正在尝试用selenium生成数据块报告。我已经编写了生成报告的确切代码,但必须保存报告的文件夹是空的,我也刷新了项目,但仍然无法生成报告。如果我在编码部分出错,请告诉我。这是我的密码:无法在Selenium Java中生成扩展数据块报告,java,extentreports,Java,Extentreports,我正在尝试用selenium生成数据块报告。我已经编写了生成报告的确切代码,但必须保存报告的文件夹是空的,我也刷新了项目,但仍然无法生成报告。如果我在编码部分出错,请告诉我。这是我的密码: public class ContactUsTestCase { ExtentHtmlReporter htmlReporter; ExtentReports extent; ExtentTest test; static WebDriver driver; Uti
public class ContactUsTestCase {
ExtentHtmlReporter htmlReporter;
ExtentReports extent;
ExtentTest test;
static WebDriver driver;
UtilityMethods util = new UtilityMethods();
@BeforeClass
public void launchBrowser() {
driver = UtilityMethods.openBrowser(Constants.BROWSER_NAME);
UtilityMethods.launchWebsite(Constants.URL);
}
@BeforeTest
public void startReport() {
htmlReporter = new ExtentHtmlReporter("D:\\ExtentReport");
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
extent.setSystemInfo("OS", "win 10");
extent.setSystemInfo("Host Name", "Stewart");
extent.setSystemInfo("Environment", "Chrome");
htmlReporter.config().setDocumentTitle("Automation testig report");
htmlReporter.config().setReportName("Your Logo Report Name");
htmlReporter.config().setTestViewChartLocation(ChartLocation.TOP);
htmlReporter.config().setTheme(Theme.DARK);
}
@Test(priority = 1)
public void ContactUs() {
test = extent.createTest("ContactUs", "This wil check status for Conatct us page");
// util.clickElement(Constants.OPEN_CONTACTUS);
driver.findElement(By.id("email")).sendKeys("stewart****@yahoo.com");
driver.findElement(By.id("pass")).sendKeys("******");
driver.findElement(By.xpath("//input[@value='Log In']")).click();
test.log(Status.PASS, MarkupHelper.createLabel("PASS", ExtentColor.GREEN));
}
@AfterClass
public void teardown() {
extent.flush();
}
}
您错过了html报告的扩展,
您的路径应该是
“D:\\Demo\u ExtentReport.html”
您只提到了文件夹名称。换行
htmlReporter = new ExtentHtmlReporter("D:\\ExtentReport");
在你的代码中
htmlReporter = new ExtentHtmlReporter("D:\\ExtentReport\\nameOfTheReport.html");