Class Suite
Suite instances can only be created via Runner.Builder.
All configuration fields are public final for inspection.
Example usage:
SuiteResult result = Runner.path("features/")
.tags("@smoke")
.parallel(4);
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanfinal io.karatelabs.common.Resourcefinal PathTheclasspath:-miss fallback dir — seegetClasspathRoot().final io.karatelabs.common.Resourcefinal Stringfinal io.karatelabs.common.Resourcefinal io.karatelabs.js.RunInterceptor<?> final io.karatelabs.js.DebugPointFactory<?> final DriverProviderfinal booleanfinal Stringfinal HttpClientFactorystatic final StringSubfolder for JSON output (JSONL events, etc.)final List<RunListenerFactory> final List<RunListener> final booleanfinal booleanfinal Pathfinal booleanfinal booleanfinal booleanfinal booleanfinal booleanfinal booleanfinal PathTHE project root — seegetRoot().final Stringfinal booleanfinal Stringfinal intfinal Path -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidvoidaddSummaryCard(Map<String, Object> card) Contribute one KPI summary card to the summary-page hero (a key/value tile, e.g.booleanWhether a scenario's nested call trees can be dropped the moment the scenario ends, rather than waiting for its feature to finish.booleanReturns the karate-boot.jsBootBindingpopulated during construction, ornullwhen no boot file is present in the workdir.getCallOnceCache(String featureKey) Get the callOnce cache for the given feature key (its resource URI).getCallOnceLock(String featureKey) getChannelFactory(String type) Ext-registeredChannelFactoryfor the given type, ornullif none — in which casekarate.channel()falls back to the built-in name->FQCN map.The directory aclasspath:reference retries against when the classloader misses, declared byboot.classpath(dir)inkarate-boot.js.The directory of the resolvedkarate-config.js.The ext global registered undername, ornullif none.Immutable view of all ext globals, in registration order.Immutable view of all registered ext report-asset specs, in registration order.getRoot()THE root — the single anchor every path reference resolves against: a leading/means this directory, a bare ref is relative to it, and aclasspath:miss falls back undergetClasspathRoot().getSetupOnceCache(String featureKey) The contributed KPI summary cards, in registration order (empty when no ext added any).Get system properties for karate.properties.getSystemProperty(String key) One property, without building the map — whatkarate.sysprop(name)wants.The launch/output anchor.booleanbooleanWhether each step's Karate output is collected intoStepResult.log— seeRunner.Builder.captureStepLogs(boolean).booleanbooleanvoidregisterChannelFactory(String type, ChannelFactory factory) Register aChannelFactoryfor an async channel type (e.g.voidregisterExtListener(Ext ext) Register anExtas aRunListeneron this Suite.voidregisterGlobal(String name, ExtGlobalFactory factory) Register a per-scenario ext global: theExtGlobalFactoryis invoked once per scenario at seed time to mint a fresh instance bound with the scenario'sKarateJsContext.voidregisterGlobal(String name, Object instance) Register an ext global undername, seeded into every scenario's JS scope beforekarate-config.jsevaluates.voidregisterReportAssets(ReportAssets assets, ClassLoader classLoader) Register an ext's report-asset contribution.voidrun()
-
Field Details
-
KARATE_JSON_SUBFOLDER
Subfolder for JSON output (JSONL events, etc.)- See Also:
-
features
-
env
-
tagSelector
-
threadCount
public final int threadCount -
parallel
public final boolean parallel -
dryRun
public final boolean dryRun -
configPath
-
outputDir
-
workingDir
-
root
THE project root — seegetRoot(). Computed before config discovery. -
classpathRoot
Theclasspath:-miss fallback dir — seegetClasspathRoot(). Never null. -
outputHtmlReport
public final boolean outputHtmlReport -
outputJsonLines
public final boolean outputJsonLines -
outputJunitXml
public final boolean outputJunitXml -
outputCucumberJson
public final boolean outputCucumberJson -
backupReportDir
public final boolean backupReportDir -
outputConsoleSummary
public final boolean outputConsoleSummary -
retainCallResults
public final boolean retainCallResults -
retainStepLogs
public final boolean retainStepLogs -
systemProperties
-
listeners
-
listenerFactories
-
driverProvider
-
httpClientFactory
-
skipTagFiltering
public final boolean skipTagFiltering -
lineFilters
-
scenarioName
-
debugInterceptor
public final io.karatelabs.js.RunInterceptor<?> debugInterceptor -
debugPointFactory
public final io.karatelabs.js.DebugPointFactory<?> debugPointFactory -
baseResource
public final io.karatelabs.common.Resource baseResource -
configResource
public final io.karatelabs.common.Resource configResource -
configEnvResource
public final io.karatelabs.common.Resource configEnvResource
-
-
Method Details
-
run
-
registerExtListener
Register anExtas aRunListeneron this Suite. Called fromBootBinding.ext(String)during karate-boot.js evaluation, before SUITE_ENTER fires. Ext will see every event from SUITE_ENTER onward. -
getWorkingDir
The launch/output anchor. EqualsgetRoot()when the project declaresboot.classpath. -
getRoot
THE root — the single anchor every path reference resolves against: a leading/means this directory, a bare ref is relative to it, and aclasspath:miss falls back undergetClasspathRoot(). Resolution is fully deterministic — no filesystem probing — so one spelling lands on the same file on every machine.Assigned before config discovery and before
karate-boot.jsevaluates, from the explicitconfigDir(a*.jsvalue contributes its parent), else a classloader probe of the config path (a Java project'starget/test-classes), else the explicitworkingDir, else the process CWD. It is deliberately NOT derived from where the config file was found, so a mapped config dir cannot silently move the root. -
getClasspathRoot
The directory aclasspath:reference retries against when the classloader misses, declared byboot.classpath(dir)inkarate-boot.js. EqualsgetRoot()when nothing is declared — so a bare-folder project needs no declaration at all. Never null. -
getConfigDir
The directory of the resolvedkarate-config.js. Retained for reporting/diagnostics only —getRoot()is the anchor for path references; this value can differ from it (a project that maps its resources keeps its config under the mapped dir). -
getBootBinding
Returns the karate-boot.jsBootBindingpopulated during construction, ornullwhen no boot file is present in the workdir. Surfaced soSuiteRunEvent.toJson()can attachexts[]manifests to SUITE_ENTER — receivers read this to know which exts were active and which embed names to expect. -
registerChannelFactory
Register aChannelFactoryfor an async channel type (e.g."grpc","kafka"). Called by an ext fromExt.onBoot(Suite)— typically right after its license gate passes — sokarate.channel('grpc')resolves to the ext-supplied factory instead of theio.karatelabs.ext.<type>.<Type>ChannelFactoryname-convention fallback. The factory instance is suite-scoped, giving the ext a home for suite/JVM-wide init (shared channels, pools). Last registration for a type wins. -
getChannelFactory
Ext-registeredChannelFactoryfor the given type, ornullif none — in which casekarate.channel()falls back to the built-in name->FQCN map. -
registerGlobal
Register an ext global undername, seeded into every scenario's JS scope beforekarate-config.jsevaluates. Called by anExtfromExt.onBoot(Suite); the instance is typically aSimpleObjectso members cross into JS natively (no reflection). Throws — and so fails the Suite at boot — when the name is blank or collides with a built-in global (karate,read,match,driver). -
registerGlobal
Register a per-scenario ext global: theExtGlobalFactoryis invoked once per scenario at seed time to mint a fresh instance bound with the scenario'sKarateJsContext. Prefer this over the singletonregisterGlobal(String, Object)when the global carries per-scenario mutable state or needs runtime / path access — seeExtGlobalFactory. -
getGlobal
The ext global registered undername, ornullif none. -
getGlobals
Immutable view of all ext globals, in registration order. -
registerReportAssets
Register an ext's report-asset contribution. Called by anExtfromExt.onBoot(Suite)with a fluentReportAssetsspec, e.g.suite.registerReportAssets(ReportAssets.named("image").js("static/ext.js"), getClass().getClassLoader()). Validates the spec against the classloader (referenced resources must exist); any failure throws and so fails the Suite loud at boot (see EXT.md § Report assets). -
getReportAssets
Immutable view of all registered ext report-asset specs, in registration order. -
addSummaryCard
Contribute one KPI summary card to the summary-page hero (a key/value tile, e.g.{label:'Coverage', value:'53%', sub:'8/15 endpoints'}). Called by anExtfromExt.onShutdown()(the values are post-run), which the run loop invokes before the report listener writes the summary, so cards are inlined into the page. Optional keys the renderer understands:sub(a second line),href(click-through), andstatus(ok/warn/fail, for accent colour). -
getSummaryCards
The contributed KPI summary cards, in registration order (empty when no ext added any). -
fireEvent
-
getOutputDir
-
getCallSingleCache
-
getCallSingleLock
-
getCallOnceCache
Get the callOnce cache for the given feature key (its resource URI). The cache is created on first access and reused across all FeatureRuntimes for the same feature within this Suite — and across Suites when the underlying store was injected via Runner.Builder. -
getCallOnceLock
-
getSetupOnceCache
-
getLockManager
-
getScenarioExecutor
-
getScenarioSemaphore
-
acquireLane
public void acquireLane() -
releaseLane
public void releaseLane() -
getCurrentLaneName
-
abort
public void abort() -
isAborted
public boolean isAborted() -
getResult
-
canReleaseCallResultsAtScenarioEnd
public boolean canReleaseCallResultsAtScenarioEnd()Whether a scenario's nested call trees can be dropped the moment the scenario ends, rather than waiting for its feature to finish.This is what bounds memory for the shape that actually hurts: a single feature holding thousands of scenarios — a
Scenario Outline— where feature end is the end of the whole run and releasing there frees nothing.Only safe when nothing will want the detail later. The report writers build their output per feature, so they need every scenario's nesting still attached when the feature completes; a suite with any result listener therefore holds on until then. With no listeners — load runs, karate-gatling, reporting explicitly disabled — nothing ever reads it and it can go immediately. Custom listeners count as consumers, since there is no way to know what a caller's listener reads.
-
getResultListeners
-
getSystemProperties
Get system properties for karate.properties.A live view, not a copy: reading one key does not walk the JVM's whole property table, which
karate.sysprop('x')and everykarate.properties['x']used to do — a fresh HashMap of every system property, per access. Iteration still materializes. -
getSystemProperty
One property, without building the map — whatkarate.sysprop(name)wants. Builder-supplied properties win over the JVM's, matching the merge order of the view. -
getDriverProvider
-
getPerfHook
-
getHttpClientFactory
-
isPerfMode
public boolean isPerfMode() -
isCaptureStepLogs
public boolean isCaptureStepLogs()Whether each step's Karate output is collected intoStepResult.log— seeRunner.Builder.captureStepLogs(boolean).Unset, this answers "yes, unless this is a Gatling run": under Gatling there is no HTML report and nothing else reads the buffer, so building the text (which re-parses and pretty-prints every response body) would be pure waste. Resolved lazily rather than in the constructor because
setPerfHook(io.karatelabs.core.PerfHook)runs after the Suite is built. -
isSkipTagFiltering
public boolean isSkipTagFiltering()
-