All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ught.cucumber-reporting.2.4.0.source-code.HelloCucumber Maven / Gradle / Ivy

Go to download

Provides pretty html reports for Cucumber (Behaviour-Driven Development). It works by generating html from the cucumber json report formatter. So can be used anywhere a json report is generated. Current use is in the cucumber jenkins plugin and a maven mojo to generate the same report from mvn command line when running locally.

There is a newer version: 5.8.6
Show newest version
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.velocity.exception.VelocityException;

import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.ReportBuilder;

public class HelloCucumber {

    public static void main(String[] args) throws VelocityException, IOException {
        File reportOutputDirectory = new File("target");
        List jsonFiles = new ArrayList<>();
        // jsonFiles.add("cucumber-RIFE-config.json");
        // jsonFiles.add("cucumber-RIFE-sales.json");
        // jsonFiles.add("attachments.json");
        jsonFiles.add("src/test/resources/json/sample.json");
        // jsonFiles.add("src/test/resources/net/masterthought/cucumber/embedded_image.json");

        String jenkinsBasePath = "";
        String buildNumber = "1";
        String projectName = "Damian - nasz nowy projekt";
        boolean skippedFailsBuild = true;
        boolean pendingFailsBuild = false;
        boolean undefinedFailsBuild = false;
        boolean missingFailsBuild = true;
        boolean runWithJenkins = true;
        boolean parallelTesting = false;

        // optionally only if you need
        Configuration configuration = new Configuration(reportOutputDirectory, projectName);
        configuration.setStatusFlags(skippedFailsBuild, pendingFailsBuild, undefinedFailsBuild, missingFailsBuild);
        configuration.setParallelTesting(parallelTesting);
        configuration.setJenkinsBasePath(jenkinsBasePath);
        configuration.setRunWithJenkins(runWithJenkins);
        configuration.setBuildNumber(buildNumber);

        ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
        reportBuilder.generateReports();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy