damianszczepanik / maven-cucumber-reporting

maven mojo for cucumber reporting
GNU Lesser General Public License v2.1
121 stars 111 forks source link

Cucumber maven <rerunFailingTestsCount>1</rerunFailingTestsCount> does not rerun failed tests and crashes generating pretty cucumber reports #265

Closed SeleniumNinja closed 1 month ago

SeleniumNinja commented 1 month ago

Hello, could you tell me what are required dependencies to make cucumber reporting plugin working when I want to rerun failed tests ? I am using in my project the following dependencies. Could you tell me what is wrong ?

When I set to value 0 <rerunFailingTestsCount>0</rerunFailingTestsCount> then everything works fine and pretty cucumber reports are generated successfully.

But when I set the value to more than 0 <rerunFailingTestsCount>1</rerunFailingTestsCount> then I get error

net.masterthought.cucumber.ValidationException: File 'C:\Users\testuser\git\project\target\jsonReports\cucumber-report.json' is not a valid Cucumber report! No content to map due to end-of-input 

at [Source: REACTED ('StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION' disabled); line: 1]
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 <modelVersion>4.0.0</modelVersion>

 <groupId>org.example</groupId>
 <artifactId>Cucumber</artifactId>
 <version>1.0-SNAPSHOT</version>

 <properties>
 <maven.compiler.source>11</maven.compiler.source>
 <maven.compiler.target>11</maven.compiler.target>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 <browser>testPurpose</browser>
 <remote>local</remote>
 </properties>

 <dependencies> <dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-java</artifactId>
 <version>4.22.0</version>

 </dependency><dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.11.0-M2</version>
    <scope>test</scope>
</dependency>

<dependency>
 <groupId>io.cucumber</groupId>
 <artifactId>cucumber-java</artifactId>
 <version>7.18.0</version>
</dependency>

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

<dependency>
    <groupId>net.masterthought</groupId>
    <artifactId>maven-cucumber-reporting</artifactId>
    <version>5.8.1</version>
</dependency>

</dependencies>

<build>
 <plugins>
 <plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
 <version>3.3.1</version>
 <configuration> 
<rerunFailingTestsCount>0</rerunFailingTestsCount>
 <testFailureIgnore>true</testFailureIgnore>
 <reportsDirectory>${project.build.directory}/surefire-reports/unit</reportsDirectory>
</configuration>
</plugin>

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-compiler-plugin</artifactId>
 <version>3.13.0</version>
 <configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>

<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>5.8.1</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>Cucumber</projectName>
<!-- optional, per documentation set this to "true" to bypass generation of Cucumber Reports entirely, defaults to false if not specified -->
<skip>false</skip>
<!-- output directory for the generated report -->
<outputDirectory>${project.build.directory}</outputDirectory>
<!-- optional, defaults to outputDirectory if not specified -->
<inputDirectory>${project.build.directory}/jsonReports</inputDirectory>
<jsonFiles>
<!-- supports wildcard or name pattern -->
<param>**/*.json</param>
</jsonFiles>
<!-- optional, defaults to outputDirectory if not specified -->

<!-- optional, set true to group features by its Ids -->
<mergeFeaturesById>false</mergeFeaturesById>
<!-- optional, set true to get a final report with latest results of the same test from different test runs -->
<mergeFeaturesWithRetest>false</mergeFeaturesWithRetest>
<!-- optional, set true to fail build on test failures -->
<checkBuildResult>false</checkBuildResult>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
SeleniumNinja commented 1 month ago

when I set the value to 1 or 2 1 Chrome browser opens only once instead or twice or more - could you help ?

damianszczepanik commented 1 month ago

The goal of this is to generate test report and not run tests so rerunning has no sense in this case