我正在尝试使用Allure-framework为我的Selenium WebDriver测试生成报告。我使用JUnit
框架和allure-maven-plugin与Allure 1.3.9版本。我使用mvn test
运行测试,然后使用mvn site
生成报告。我在target/site/allure-maven-plugin/
目录中看到了生成的报告。当我用Firefox打开index.html页面时,它可以正常工作。然而,当在Chrome或Safari中做同样的事情时,我什么也看不见。
怎么了?我错过了什么吗?我的pom.xml
文件位于here。
此问题与默认Webkit安全设置有关,该设置禁止在本地文件系统上执行Ajax请求。您至少有两种可能的解决方案:
$ allure报告公开
除上述答案外,使用“--ignore-certificate-errors”和chromeOptions可能会有所帮助。
DesiredCapabilities capabilities;
capabilities = DesiredCapabilities.chrome();
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--ignore-certifcate-errors");
chromeOptions.addArguments("test-type");
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
要在chrome中使用诱惑报告,您有两种选择:
mvn allure:serve
目标。它会生成报告并在Chrome中打开一个标签(如果是默认浏览器)mvn allure:report
目标生成报告,并使用任何http服务器为您自己提供服务。如果你有节点你可以使用http-server
例如npm install http-server -g
然后http-server target/site/allure-maven-plugin
)不要使用--allow-file-access-from-files
旗,是危险的
Allure 404错误: