Package io.karatelabs.core
Class KarateOptionsHandler
java.lang.Object
io.karatelabs.core.KarateOptionsHandler
Applies system-property and environment-variable overrides to a
Runner.Builder
at the start of parallel(). This preserves the v1 "CI override" contract where
Maven/Gradle users pass -Dkarate.options="--tags @smoke" to override a Runner
class's hard-coded values without a code change.
Precedence (highest first):
-Dkarate.options="..."system propertyKARATE_OPTIONSenvironment variable (fallback)- Individual sysprops:
karate.env,karate.config.dir, with env var fallbacks (KARATE_ENV,KARATE_CONFIG_DIR) - Builder values set programmatically
karate-pom.jsonvalues (applied upstream byRunCommand)- Defaults
Implementation reads each override and applies it via the Builder's package-private
setters, reusing the v2 CLI grammar through CommandLine.populateCommand(T, java.lang.String...) on a
RunCommand instance.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic intapply(Runner.Builder builder, int threadCount) Apply sysprop/env overrides to the given Builder.static voidapplyEnvAndConfigDir(Runner.Builder builder) Apply only the individualkarate.env/karate.config.dirsysprop and environment-variable overrides to the builder — without parsingkarate.options.
-
Field Details
-
PROP_OPTIONS
- See Also:
-
PROP_ENV
- See Also:
-
PROP_CONFIG_DIR
- See Also:
-
ENV_OPTIONS
- See Also:
-
ENV_ENV
- See Also:
-
ENV_CONFIG_DIR
- See Also:
-
-
Method Details
-
apply
Apply sysprop/env overrides to the given Builder. Returns the effective thread count: ifkarate.optionsspecified--threads N, returnsN; otherwise returns thethreadCountargument unchanged. -
applyEnvAndConfigDir
Apply only the individualkarate.env/karate.config.dirsysprop and environment-variable overrides to the builder — without parsingkarate.options. Used by single-feature entry points (e.g. karate-gatling'sRunner.runFeature) that build aSuitedirectly and so never go throughapply(io.karatelabs.core.Runner.Builder, int).
-