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

net.masterthought.cucumber.generators.FailuresOverviewPage Maven / Gradle / Ivy

Go to download

Provides pretty html reports for Cucumber. It works by generating html from the cucumber json file.

There is a newer version: 5.8.2
Show newest version
package net.masterthought.cucumber.generators;

import java.util.ArrayList;
import java.util.List;

import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.ReportResult;
import net.masterthought.cucumber.json.Element;
import net.masterthought.cucumber.json.Feature;

public class FailuresOverviewPage extends AbstractPage {

    public static final String WEB_PAGE = "overview-failures.html";

    public FailuresOverviewPage(ReportResult reportResult, Configuration configuration) {
        super(reportResult, "overviewFailures.vm", configuration);
    }

    @Override
    public String getWebPage() {
        return WEB_PAGE;
    }

    @Override
    public void prepareReport() {
        context.put("failures", collectFailures());
    }

    private List collectFailures() {
        List failures = new ArrayList<>();
        for (Feature feature : reportResult.getAllFeatures()) {
            if (feature.getStatus().isPassed()) {
                continue;
            }

            for (Element element : feature.getElements()) {
                if (!element.getStepsStatus().isPassed()) {
                    failures.add(element);
                }
            }
        }
        return failures;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy