Package io.karatelabs.core
Class Runner
java.lang.Object
io.karatelabs.core.Runner
Main entry point for running Karate tests programmatically.
Example usage:
SuiteResult result = Runner.path("src/test/resources")
.tags("@smoke")
.karateEnv("dev")
.parallel(5);
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Runner.Builderbuilder()Get a new builder instance.static Runner.BuilderStart building a test run with Feature objects.static Runner.BuilderStart building a test run with one or more paths.static Runner.BuilderStart building a test run with a list of paths.static FeatureResultrunFeature(String path, Map<String, Object> arg) Execute a single feature with pre-defined variables.static FeatureResultRun a single feature file with arguments and optional PerfHook.static FeatureResultRun a single feature file with arguments, optional PerfHook and tag filter.static FeatureResultrunFeature(String path, Map<String, Object> arg, PerfHook perfHook, List<String> tags, Runner.Builder template) Run a single feature with arguments, optional PerfHook, tag filter, and a pre-configuredRunner.Buildertemplate (env, configDir, systemProperties).
-
Method Details
-
path
Start building a test run with one or more paths. Paths can be directories or individual .feature files. -
path
Start building a test run with a list of paths. -
features
Start building a test run with Feature objects. -
builder
Get a new builder instance. -
runFeature
Execute a single feature with pre-defined variables. This is called by karate-gatling for running features with Gatling session variables.- Parameters:
path- the feature path (can be classpath: prefixed)arg- variables to inject into the feature (available as top-level variables)- Returns:
- the feature result
-
runFeature
Run a single feature file with arguments and optional PerfHook.This method is primarily used by Gatling integration for running features with performance metric collection.
- Parameters:
path- the feature path (can be classpath: prefixed)arg- variables to inject into the feature (available as top-level variables)perfHook- optional PerfHook for performance metric collection (Gatling)- Returns:
- the feature result
-
runFeature
public static FeatureResult runFeature(String path, Map<String, Object> arg, PerfHook perfHook, List<String> tags) Run a single feature file with arguments, optional PerfHook and tag filter.This method is primarily used by Gatling integration. The
tagsargument follows the same semantics asRunner.Builder.tags(String...)— each entry is a tag expression; multiple entries are AND-ed together; commas within an entry are OR.- Parameters:
path- the feature path (can be classpath: prefixed)arg- variables to inject into the feature (available as top-level variables)perfHook- optional PerfHook for performance metric collection (Gatling)tags- optional tag filter expressions (null or empty means no filter)- Returns:
- the feature result
-
runFeature
public static FeatureResult runFeature(String path, Map<String, Object> arg, PerfHook perfHook, List<String> tags, Runner.Builder template) Run a single feature with arguments, optional PerfHook, tag filter, and a pre-configuredRunner.Buildertemplate (env, configDir, systemProperties).Used by karate-gatling to expose
protocol.runner.karateEnv(...)etc. The template'senv,configDir, andsystemPropertiesare applied; everything else (paths, listeners, output flags) is overridden for the single-feature, no-report execution model.
-