Package io.karatelabs.core
Class Suite
java.lang.Object
io.karatelabs.core.Suite
Immutable suite configuration and execution engine.
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 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 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.booleanReturns the karate-boot.jsBootBindingpopulated duringrun(), 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 of the resolvedkarate-config.js— for a Java project this is the classpath root (target/test-classes/src/test/resources), sinceconfigResourceis filesystem-backed even when found viaclasspath:.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.getSetupOnceCache(String featureKey) The contributed KPI summary cards, in registration order (empty when no ext added any).Get system properties for karate.properties.Workdir for boot.js discovery + per-ext file resolution.booleanbooleanbooleanvoidregisterChannelFactory(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
-
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 -
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
Workdir for boot.js discovery + per-ext file resolution. -
getConfigDir
The directory of the resolvedkarate-config.js— for a Java project this is the classpath root (target/test-classes/src/test/resources), sinceconfigResourceis filesystem-backed even when found viaclasspath:. The canonical anchor for resolving path references (an ext / boot-config path string), so a project's resources resolve with noclasspath:prefix.Fallbacks for the cases where
karate-config.jsis absent: when an explicitconfigDirwas set on the CLI/Runner but holds no config file, the configured directory is still honoured (derived fromconfigPath); when there is no config at all (the defaultclasspath:lookup found nothing), it falls back toworkingDir. -
getBootBinding
Returns the karate-boot.jsBootBindingpopulated duringrun(), 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
-
getResultListeners
-
getSystemProperties
Get system properties for karate.properties. -
getDriverProvider
-
getPerfHook
-
getHttpClientFactory
-
isPerfMode
public boolean isPerfMode() -
isSkipTagFiltering
public boolean isSkipTagFiltering()
-