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

com.appium.cucumber.report.HtmlReporter Maven / Gradle / Ivy

There is a newer version: 14.0.4
Show newest version
package com.appium.cucumber.report;

import com.appium.filelocations.FileLocations;
import net.masterthought.cucumber.Configuration;
import net.masterthought.cucumber.ReportBuilder;
import org.apache.velocity.exception.VelocityException;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class HtmlReporter {

    public File reportOutputDirectory = new File(System.getProperty("user.dir")
            + FileLocations.OUTPUT_DIRECTORY);
    public List list = new ArrayList();

    public void listFilesForFolder(final File folder) {
        for (final File fileEntry : folder.listFiles()) {
            if (fileEntry.isDirectory()) {
                listFilesForFolder(fileEntry);
            } else if (fileEntry.getName().endsWith(".json")) {
                System.out.println("*******" + fileEntry.getName());
                list.add(reportOutputDirectory + "/" + fileEntry.getName());

            }
        }
    }

    public void generateReports() throws VelocityException, IOException {
        listFilesForFolder(reportOutputDirectory);
        String jenkinsBasePath = "";
        String buildNumber = "1";
        String projectName = "cucumber-jvm";

        Configuration configuration = new Configuration(reportOutputDirectory, projectName);
        configuration.setBuildNumber(buildNumber);

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy