Monday 5 January 2015

org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description

org.junit.runner.Description.createSuiteDescription(Ljava/lang/String;Ljava/io/Serializable;[Ljava/lang/annotation/Annotation;)Lorg/junit/runner/Description

I found the cause of this the problem is that the cucumber.json file does not exist.

I addressed this in my project by adding json:target under the @CucumberOptions annotation, this then generated the json. for example @CucumberOptions(features = "src/test/resources/features/some.feature", monochrome = false, format = {"pretty", "json:target/cucumber.json"})

The masterthought plugin then processes the generated JSON by looking for it at ${project.build.directory}/cucumber.json

At this point the Maven plugin generates the HTML from the JSON.


For this you have to setup as below at both the places

and in Junit runner .. mention "json:target/cucumber.json" problem will resolve.


package skeleton;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(format = {
        "pretty","html:target/cucumber-html-reports","json:target/cucumber.json" })


public class RunCukesTest {
}



In pom.xml do like this
 <plugin>
                <groupId>net.masterthought</groupId>
                <artifactId>maven-cucumber-reporting</artifactId>
                <version>0.0.5</version>
                <executions>
                    <execution>
                        <id>execution</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <projectName>cucumber-jvm-example</projectName>
                            <outputDirectory>${project.build.directory}/cucumber-html-reports</outputDirectory>
                            <cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
                
                            <enableFlashCharts>false</enableFlashCharts>
                        </configuration>
                    </execution>
                </executions>

            </plugin>


References

https://github.com/masterthought/maven-cucumber-reporting-mojo

http://www.masterthought.net/section/cucumber-reporting-downloads

No comments:

Post a Comment