Огурец - Java - отчеты об экстентах - исключение NullPointerException на com.cucumber.listener.Reporter.loadXMLConfig - PullRequest
0 голосов
/ 09 апреля 2020

Привет, сообщество: я пытаюсь создавать отчеты о степени огурца. Я могу создать отчеты, но после выполнения я сталкиваюсь с следующей ошибкой:

java.lang.NullPointerException
at com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56)
at runners.TestExtentReports.createExtentReport(TestExtentReports.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

Это мой класс бегуна:

import com.cucumber.listener.ExtentProperties;
import com.cucumber.listener.Reporter;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import readers_extent_reports.FileReaderManager;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

@RunWith(Cucumber.class)
@CucumberOptions(
        features = "src/test/resources/features",
        glue= {"stepdefs", "properties", "src/main/java/properties", "drivers", "src/main/java/drivers"},
        monochrome = true,
        plugin = { "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"}
)

public class TestExtentReports {

    @BeforeClass
    public static void Reportsetup() {
        String timeStamp = new SimpleDateFormat("dd.MM.yyyy.HH.mm.ss").format(new Date());
        ExtentProperties extentProperties = ExtentProperties.INSTANCE;
        extentProperties.setReportPath("target/extent-reports/"+timeStamp.replace(":","_").replace(".","_")+".html");
    }


    @AfterClass
    public static void createExtentReport() {
        Reporter.loadXMLConfig(new File(FileReaderManager.getInstance().getConfigReader().getReportConfigPath()));
        Reporter.setSystemInfo("user", System.getProperty("user.name"));
        Reporter.setSystemInfo("os", "Mac OSX");
        Reporter.setTestRunnerOutput("Creating Extent Reports...");
    }
}

Это мои зависимости POM:

<dependencies>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
    <dependency>
        <groupId>io.github.bonigarcia</groupId>
        <artifactId>webdrivermanager</artifactId>
        <version>3.8.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.5</version>
    </dependency>
    <!-- https://github.com/prashant-ramcharan/courgette-jvm -->
    <dependency>
        <groupId>io.github.prashant-ramcharan</groupId>
        <artifactId>courgette-jvm</artifactId>
        <version>4.4.0</version>
    </dependency>
    <!-- https://http://grasshopper.tech/824/(Extent Reports Adapter for Cucumber 4) (Keep the version 1.0.8) -->
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports-cucumber4-adapter</artifactId>
        <version>1.0.9</version>
        <exclusions>
            <exclusion>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-java</artifactId>
            </exclusion>
            <exclusion>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-core</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
    <dependency>
        <groupId>net.masterthought</groupId>
        <artifactId>cucumber-reporting</artifactId>
        <version>4.11.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.vimalselvam/cucumber-extentsreport -->
    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.0.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/info.cukes/gherkin -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>gherkin</artifactId>
        <version>2.12.2</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

А вот и мой файл ext.properties

extent.reporter.html.start=true
extent.reporter.logger.start=true
extent.reporter.spark.start=true

extent.reporter.html.config=src/test/resources/extent-config.xml
extent.reporter.spark.config=src/test/resources/extent-config.xml
extent.reporter.logger.config=src/test/resources/extent-config.xml
#Use below setting to fix FreeMarker exception in Logger report
#extent.reporter.spark.config=src/test/resources/extent-config-logger.xml

extent.reporter.html.out=target/test-output/HtmlReport/ExtentHtml.html
extent.reporter.logger.out=target/test-output/Logger
extent.reporter.spark.out=target/test-output/Spark

screenshot.dir=target/test-output/

Вторая проблема здесь - это ошибка JavaScript: https://www.google.cl/xjs/_/js/k=xjs.s.es_419.G42wN0D3QfE.O / ck = x js .s.8vt8V6XEN10 .L.F4.O / ч = AAQAAMASgFk3AJz_QQAAF8o4AAAgQBvBxgIpIiEhAAGssAgAAQ / д = 1 / EXM = Fkg7bd, HcFEGb, IvlUe, MC8mtf, OF7gz * * тысяча двадцать-один, RMhBfe, T4BA * * тысяча двадцать-два, TJw5qb, TbaHG c, Y33vz c, ZyRBae , CDOS, кр, ИБК, д, HSM, iDPoPb, АПБ, mvYTse, tg8oTe, uz938 c, vWNDde, ws9Tl c, yQ43ff / Под ред = 1 / дг = 2 / кт = zgms / Rs = ACT90oFo2UWkkkTsAwBPOEuu0XhNiIlZRQ / м = DqdCgd, F8FRnd, MkHyGd, NBZ7u, NZI0Db, NpD4e * тысяча двадцать-семь *, OG6ZHd, RqxLvf, T6sTsf, T7XTS, TxZW cc, URQPY c, Wq6lxf, XjCeU c, aCZVp, аа, aam1T, ABD, adinfo , ASYN c, ATTL, БГД, дп c, DVL, eN4qad, Exd c, ноги, iD8Yk, Кын, lazG7b, л, м, mI3LFb, mUpTid, mpck, мю, o02J ie, pB6Zqd , qik19b, qjr3n c, rHjpXd, runuse, sQAo4b, sb_wiz, научная фантастика, Т.Л., uiNkee, против, wQpTu c, wkrYee, xz7cCd, zUPIy, zbML3 c? XJS = s1 * 10 16 *

Пожалуйста, если кто-нибудь может мне помочь ...

...