Rajat Prajapati
Rajat Prajapati

Reputation: 23

Not able to generate allure-report using selenium java cucumber

I am struggling with the below error as I am not able to generate an allure report. I am getting the below error when tried executing mvn allure:report command

Failed to execute goal io.qameta.allure:allure-maven:2.8:report (default-cli) on project AutomationFramework1.0: An error has occurred in Allure report generation.

[INFO]
[INFO] --- allure-maven:2.8:report (default-cli) @ AutomationFramework1.0 ---
[INFO] Allure installation denter code hereirectory D:\AutomationFramework1.0/.allure
[INFO] Try to finding out allure 2.0.1
[INFO] Generate Allure report (report) with version 2.0.1
[INFO] Generate Allure report to D:\AutomationFramework1.0\target\site/allure-maven-plugin
[INFO] Found results directory D:\AutomationFramework1.0\target\allure-results
[INFO] Can't find information about categories.
[INFO] Generate report to D:\AutomationFramework1.0\target\site\allure-maven-plugin
[ERROR] Can't generate allure report data
java.io.IOException: Cannot run program "D:\AutomationFramework1.0.allure\allure-2.0.1\bin\allure.bat" (in directory "."): CreateProcess error=2, The system cannot find the file specified

My Project folder structure looks like below. Project Folder Structure

Dependencies which I have used in pom.xml are below.

`

<dependencies>
    <!-- For selenium WebDriver-->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.7.0</version>
    </dependency>

    <!-- For cucumber-->
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>4.2.0</version>
        <scope>compile</scope>

    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>4.2.0</version>
        <scope>compile</scope>

    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-picocontainer</artifactId>
        <version>4.2.0</version>
    </dependency>

    <!-- For Reporting-->
    <dependency>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-cucumber4-jvm</artifactId>
        <version>2.10.0</version>
    </dependency>

    <!-- Other utilities -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.5</version>
    </dependency>
</dependencies>
   <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M5</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
        </plugin>
        <plugin>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-maven</artifactId>
            <version>2.8</version>
        </plugin>
    </plugins>
</build>

`

Upvotes: 0

Views: 1465

Answers (1)

Alex Y
Alex Y

Reputation: 33

Your build section is not configured properly. Please refer to https://docs.qameta.io/allure/#_maven_4 you should use

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.20</version>
        <configuration>
            <argLine>
                -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
                -Dcucumber.options="--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm"
            </argLine>
        </configuration>
        <dependencies>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjweaver</artifactId>
                <version>${aspectj.version}</version>
            </dependency>
        </dependencies>
    </plugin>
</plugins>

add aspectj to property section, and specify directories to report and results in configuration

Upvotes: 1

Related Questions