繁体   English   中英

Cucumber:未在 output 文件夹中生成范围报告

[英]Cucumber:Extent report is not getting generated in the output folder

我在 Cucumber 和 jUnit 中使用范围报告,它对我来说工作正常,但是每当我的测试运行完成时,我的项目 output 文件夹中就不会生成范围报告。

下面是我的跑步者 Class

 package mortgage.runners;
import org.junit.runner.RunWith;   
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)

@CucumberOptions(
plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:", "json:target/cucumber-report.json"},
features = {"src/test/resources/features"},
glue = {"mortgage.stepdefinitions"},
// dryRun = true,
tags = "@RegressionTest",
monochrome = true) 

public class CukesRunner {    
}

我在 pom.xml 文件中添加了以下 maven 依赖项

<dependencies>
<dependency>
    <groupId>org.assertj</groupId>
    <artifactId>assertj-core</artifactId>
    <version>3.12.1</version>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>4.1.0</version>
</dependency>

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.0</version>
</dependency>

<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.6</version>
</dependency>

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-api</artifactId>
    <version>2.12.1</version>
</dependency>

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-core</artifactId>
    <version>2.12.1</version>
</dependency>

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.8.1</version>
</dependency>

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-text</artifactId>
    <version>1.6</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
</dependency>

<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.2.0</version>
</dependency>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.13-beta-1</version>
</dependency>
<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports-cucumber4-adapter</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
    <exclusions>
       <exclusion>
           <artifactId>extentreports</artifactId>
           <groupId>com.aventstack</groupId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-core</artifactId>
    <version>4.0.1</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>4.0.1</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-junit</artifactId>
    <version>4.0.1</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>com.aventstack</groupId>
    <artifactId>extentreports</artifactId>
    <version>4.0.0</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.1.0</version>
</dependency>
</dependencies>  

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
            <encoding>UTF-8</encoding>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>

</plugins>
</build>

以下是我在报告部分遇到的错误,而且我没有看到在输出/目标文件夹中生成任何 html 文件我什至尝试将范围报告版本更新为 4.0.7 但仍然相同的问题目标文件夹为空

java.lang.NullPointerException at com.aventstack.extentreports.utils.ExceptionUtil.getExceptionHeadline(ExceptionUtil.java:25) at com.aventstack.extentreports.model.ExceptionInfo.(ExceptionInfo.java:19)

尝试删除 config 的值并将其保留为空,因为适配器不需要配置文件。 像'extent.reporter.html.config='一样通过

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM