Runner Builder
The runner builder is the fluent API for registering scenarios, applying runtime settings, and executing a LoadStrike run.
Matching docs
Search across docs titles, summaries, groups, and section headings.
Use Up and Down Arrow to move through results, then press Enter to open the active page.
No indexed docs matched that search. Try a broader term or open the docs hub.
What this page helps you do
What this page helps you do
The runner builder is the fluent API for registering scenarios, applying runtime settings, and executing a LoadStrike run.
Who this is for
Engineers writing or reviewing scenario code in one of the supported SDKs.
Prerequisites
- A scenario or runtime surface you want to wire correctly in code
By the end
The exact SDK surface you need for this part of the runtime.
Use this page when
Use this reference when you already know the workflow and need the exact Runner Builder API surface in code.
Visual guide
Guide
Builder Pattern
Use LoadStrikeRunner.Create() to start fluent composition, then AddScenario or AddScenarios and Configure(...) to apply context options before Run(). Go, Java, Python, and TypeScript or JavaScript all mutate the same runner or context instance through fluent builders and static helper wrappers. The Go SDK documents the returned-context Configure callback on the `.NET`-named wrapper surface as `Configure(func(ctx loadstrike.LoadStrikeContext) loadstrike.LoadStrikeContext)`, keeps `Create()` as the preferred public builder entry point, and also supports `NewRunner()` as a wrapper constructor that returns `LoadStrikeRunner` instead of exposing the native runtime builder structs directly. When you already have a reusable context, ConfigureContext(context) merges that context back into the builder without dropping its registered scenarios.
BuildContext
Use BuildContext() when you want one configured LoadStrikeContext that can be reused for multiple runs. C#, Go, Java, Python, TypeScript, and JavaScript all keep the registered scenario set so LoadStrikeContext.Run() and LoadStrikeRunner.Run(context) can execute directly from that reusable context. The various Configure flows, including ConfigureContext(context), add context changes without dropping the registered scenarios. In Go, the public wrapper surface returns LoadStrikeRunResult directly from Run().
Configure Merge Behavior
Chained Configure(...) calls merge into the same LoadStrikeContext. Omitted values stay intact, while later calls replace only the fields they actually set. That makes it safe to layer identity, report, cluster, sink, and plugin options in separate builder steps instead of rebuilding the context from scratch.
Builder Guardrails
The builder validates that at least one scenario is registered before BuildContext() or Run() can succeed. Empty builder state and empty target resolution both fail fast instead of silently producing a no-op run.
Run Overloads
Use Run() for normal execution and Run(string[] args) or Run(params string[] args) when launch-time overrides should be applied. Across all SDKs, Run() returns the full LoadStrikeRunResult with startedUtc, completedUtc, reportFiles, disabledSinks, sinkErrors, metrics, scenarioStats, flattened stepStats, scenarioDurationsMs, correlationRows, and failedCorrelationRows. It also fails fast when no scenarios are registered or when target selection resolves to none. Reusable LoadStrikeContext instances keep CLI-applied overrides after Run(args), while runner-level Run(args) calls remain one-shot per execution. Go supports variadic Run override flows for launch-time settings, and TypeScript or JavaScript also support array or variadic Run override flows, case-insensitive keys, malformed-token ignoring, numeric NodeType enum tokens, and execution-time `--config` or `--infraconfig` file loading. The Go parity wrapper now mirrors the `.NET` result contract more closely by exposing integer ScenarioDurationsMs values on the final wrapper and by keeping node type on NodeInfo rather than duplicating it at the top level of LoadStrikeRunResult.
Language Differences
The core model stays the same across SDKs, but a few helpers and result shapes use language-specific names. Check these notes when you switch languages or compare samples.
C#, Go, Java, Python, TypeScript, and JavaScript all expose Run() on the runner and reusable context surfaces. Run() returns the full LoadStrikeRunResult payload with reportFiles, disabledSinks, sinkErrors, metrics, flattened stepStats, scenarioDurationsMs, correlationRows, and failedCorrelationRows. Reports and sink exports are built from that same result automatically.
SDK reference samples
Use these SDK samples to compare how Runner Builder is exposed across the supported languages before you wire it into a full scenario.
If you run these examples locally, add a valid runner key before execution starts. Set it with WithRunnerKey("...") or the config key LoadStrike:RunnerKey.
Runner Builder
using LoadStrike;
var scenario = LoadStrikeScenario.Empty("submit-orders")
.WithLoadSimulations(LoadStrikeSimulation.KeepConstant(1, TimeSpan.FromSeconds(20)));
var runner = LoadStrikeRunner.Create()
.AddScenario(scenario)
.Configure(ctx => ctx.WithReportFolder("./reports").WithRunnerKey("rkl_your_local_runner_key"));
var context = runner.BuildContext();
var stats = context.Run("--testsuite=orders-smoke --testname=submit-orders");
package main
import loadstrike "loadstrike.com/sdk/go"
func main() {
runner := loadstrike.Create().
AddScenario(loadstrike.CreateScenario("orders", func(loadstrike.LoadStrikeScenarioContext) loadstrike.LoadStrikeReply {
return loadstrike.OK()
})).
Configure(func(ctx loadstrike.LoadStrikeContext) loadstrike.LoadStrikeContext {
return ctx.
WithRunnerKey("rkl_your_local_runner_key").
WithTestSuite("docs")
})
context := runner.BuildContext()
context.Run("--restartiterationmaxattempts=2")
}
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeRunner;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeScenario;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeSimulation;
var scenario = LoadStrikeScenario
.empty("submit-orders")
.withLoadSimulations(LoadStrikeSimulation.keepConstant(1, 20d));
var runner = LoadStrikeRunner.create()
.addScenario(scenario)
.configure(context -> context
.withReportFolder("./reports")
.withRunnerKey("rkl_your_local_runner_key"));
var context = runner.buildContext();
var stats = context.run("--testsuite=orders-smoke --testname=submit-orders");
from loadstrike_sdk import LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation
scenario = (
LoadStrikeScenario.empty("submit-orders")
.with_load_simulations(LoadStrikeSimulation.keep_constant(1, 20))
)
runner = (
LoadStrikeRunner.create()
.add_scenario(scenario)
.configure(lambda context: context.with_report_folder("./reports").with_runner_key("rkl_your_local_runner_key"))
)
context = runner.build_context()
stats = context.run("--testsuite=orders-smoke --testname=submit-orders")
import { LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation } from "@loadstrike/loadstrike-sdk";
const scenario = LoadStrikeScenario
.empty("submit-orders")
.withLoadSimulations(LoadStrikeSimulation.keepConstant(1, 20));
const runner = LoadStrikeRunner
.create()
.addScenario(scenario)
.Configure((context) => context.withReportFolder("./reports").withRunnerKey("rkl_your_local_runner_key"));
const context = runner.BuildContext();
const stats = await context.run("--testsuite=orders-smoke --testname=submit-orders");
const { LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation } = require("@loadstrike/loadstrike-sdk");
(async () => {
const scenario = LoadStrikeScenario
.empty("submit-orders")
.withLoadSimulations(LoadStrikeSimulation.keepConstant(1, 20));
const runner = LoadStrikeRunner
.create()
.addScenario(scenario)
.Configure((context) => context.withReportFolder("./reports").withRunnerKey("rkl_your_local_runner_key"));
const context = runner.BuildContext();
const stats = await context.run("--testsuite=orders-smoke --testname=submit-orders");
})();
Runner builder methods
Starts an empty fluent builder.
Adds one or more scenarios to the builder. At least one scenario must exist before BuildContext or Run can succeed.
Applies any LoadStrikeContext configuration such as runner key, report output, cluster settings, sinks, or plugins.
Chained Configure calls merge into the same context. Later calls replace only the fields they set, while omitted settings stay intact.
Shortcut builder methods for the most common run identity fields.
Shortcut builder methods for common report-output behavior.
Shortcut builder methods for two frequently adjusted runtime controls.
Materializes a reusable LoadStrikeContext after validating that at least one scenario was added. Empty builder state and empty target resolution both fail fast.
Builds the context and executes it immediately. Run(args) applies one-shot CLI-style overrides.
The builder behaves the same across C#, Go, Java, Python, TypeScript, and JavaScript. It keeps registered scenarios in the reusable context, fails fast when the selected scenario set is empty, preserves omitted settings during partial configure merges, and always returns the full LoadStrikeRunResult from Run().