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

net.serenitybdd.cucumber.cli.Main Maven / Gradle / Ivy

There is a newer version: 4.2.8
Show newest version
package net.serenitybdd.cucumber.cli;

import io.cucumber.core.options.CommandlineOptionsParser;
import io.cucumber.core.options.RuntimeOptions;
import io.cucumber.core.resource.ClassLoaders;
import io.cucumber.core.runtime.Runtime;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import net.serenitybdd.cucumber.CucumberWithSerenityRuntime;

import java.io.IOException;
import java.util.function.Supplier;


public class Main {

    public static void main(String[] argv) throws Throwable {
        Supplier classLoaderSupplier = ClassLoaders::getDefaultClassLoader;
        byte exitstatus = run(argv,classLoaderSupplier );
        System.exit(exitstatus);
    }

    public static byte run(String[] argv, Supplier classLoaderSupplier) throws IOException {
        RuntimeOptions  runtimeOptions = new CommandlineOptionsParser(System.out).parse(argv).build() ;
        CucumberWithSerenity.setRuntimeOptions(runtimeOptions);
        Runtime runtime = CucumberWithSerenityRuntime.using(classLoaderSupplier, runtimeOptions);

        runtime.run();
        return runtime.exitStatus();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy