This project uses Spring Boot to package the collector as an executable JAR with dependencies.

Execute the following command to package the collector into an executable JAR file.

    mvn install

Copy this file to your server and launch it using:

  java -JAR jenkins-cucumber-test-collector.jar

You will need to provide an application.properties file that contains information about how to connect to the Dashboard MongoDB database instance, as well as properties the Hudson collector requires. See the Spring Boot documentation for information about sourcing this properties file.

Sample application.properties file


The Jenkins Cucumber Test Collector makes use of the JSON formatting output of Cucumber test cases to provide dashboard results from various Jenkins jobs. This collector takes advantage of tools standards established for the Jenkins Cucumber Reports Plugin in the sense that it will look for the common output files generated by cucumber in the designated location to populate the collector.

The setup for utilizing this collector relies heavily on the output of the Cucumber test cases. All languages that utilize cucumber should allow setting the format of the output to JSON and set the name of the output file. For the usage of this collector, all output files should be entitled "cucumber.json". Since cucumber tests can be written in many languages, there are many examples of how to enable the output format. Here are a couple of examples for setting these options in Java and Ruby: For Cucumber-JVM, the Cucumber Options should be similar to the following code snippet:

  java
  @RunWith(Cucumber.class)
  @CucumberOptions( features = "src/test/features/com/sample",
    tags = { "~@wip", "@executeThis" }, monochrome = true,
    format = { "pretty", "html:target/cucumber", "json:target/cucumber.json" } )
    public class RunCukeTest {
    }

For Ruby Cucumber, the cucumber options for the ‘format’ should be set to ‘json’ and the ‘out’ should designate the correct filename. For example: Command Line:

  cucumber features/my_feature.feature --format json --out cucumber.json

After the cucumber.json output has been generated during a test run, collector will depend on a root directory to search for all output files that will be included in the results. If multiple projects are being executed or multiple cucumber commands are being called, then the folder structure created will provide the “suite” names for the test result report. For example:

    root_dir/
    |--- project1
    |    |--- cucumber.json
    |--- project2
    |    |--- cucumber.json
    |--- project3
    |    |--- cucumber.json
    ...
    ...

The setup required in a Jenkins job is fairly simple. Assuming that the correct directory structure has been established from the above setup, archiving your root directory after the build completes is all that is required. Select the “Archive the artifacts” Post-build action for your Jenkins job. Next, set the files to archive to the root of your directory tree.