selenium - 未创建 HTML 文件 - 范围报告 (Junit)
问题描述
我需要使用 Extent Report 和 Junit 创建一个报告,我开发了以下代码,但是当我运行它时,没有创建 HTML 文件(报告)。
public class Steps extends Execute {
private static ExtentHtmlReporter htmlReporter;
private static ExtentReports extentReport;
private static ExtentTest extentTest;
@BeforeMethod
public void beforeCenario(Scenario cenario) {
if(extentReport == null) {
extentReport = new ExtentReports();
htmlReporter = new
ExtentHtmlReporter("src/test/resources/htmlReporter.html");
extentReport.attachReporter(htmlReporter);
}
extentTest = extentReport.createTest(cenario.getId());
}
@Test
@Given("acessei a url do portal")
public void AcessoUrl() {
Execute Executar = new Execute();
Executar.abrirBrowser();
}
@AfterMethod
public void afterCenario(Scenario cenario) {
extentTest.log(Status.PASS, "Cenario "+ cenario.getName()+ "executado com sucesso!");
extentReport.flush();
}
我试过了@Before
,但它没有运行我的代码,我收到了这条消息:
钩子前失败:Steps.beforeCenario(Scenario) 消息:java.lang.NoClassDefFoundError: freemarker/template/TemplateModelException
freemarker 依赖于我的 pom.XML:
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.23</version>
</dependency>
我也试过@BeforeTest
了,它运行我的代码,但它也没有创建 HTML 文件。
你能帮我吗?谢谢 =)
解决方案
推荐阅读
- c# - 异步方法阻塞未等待的任务
- reactjs - 放
背景颜色随机 - marklogic-9 - DMSDK QueryBatch如何检查标记逻辑中存在的uri列表
- r - 当条件取自不同的数据帧但使用公共变量时如何应用 if 语句
- python - 可执行文件失败时从 subprocess.Popen() 捕获错误
- xamarin - 通过 Xamarin (UWP) 中的 TraceSource 进行日志记录
- python - 当字符串在列表的任何位置时返回布尔值
- bash - 当我用 tr 小写并更新值时,新值不存在
- vue.js - 变异对象以在 MDbootstrap Vue 中使用
- python - 在 Keras 中编写用于图像预处理的自定义函数