Data

Use scenario context data stores and partition metadata to drive test payloads safely.

Invocation Data

LoadStrikeScenarioContext.Data is a dictionary for invocation-scoped state exchange within the active scenario execution.

Scenario Instance Data

LoadStrikeScenarioContext.ScenarioInstanceData stores per-instance shared objects initialized in WithInit and reused across invocations of the same scenario copy.

Random Helper

LoadStrikeScenarioContext.Random exposes Next, NextDouble, NextBytes, and Sample helpers for payload variation and deterministic sharding. TypeScript/JavaScript also expose those helpers through the same PascalCase names in the public docs surface.

Partition Data

LoadStrikeScenarioInitContext.ScenarioPartition exposes Number and Count for deterministic dataset sharding in clustered or multi-copy runs.

Init Metrics

LoadStrikeScenarioInitContext.RegisterMetric(IMetric) registers custom counters and gauges during scenario initialization so thresholds, reports, and sinks see the same metric set across the supported SDKs.

Feature Usage Samples

How to use snippets for Data.

Switch between C#, Java, Python, TypeScript, and JavaScript to see the native SDK shape for this sample.

Licensing note: every runnable sample requires a valid runner key via WithRunnerKey("...") or config key LoadStrike:RunnerKey.

Context Data

var scenario = LoadStrikeScenario.Create("data-demo", context =>
{
    context.Data["requestId"] = Guid.NewGuid().ToString("N");
    context.ScenarioInstanceData["tenant"] = "alpha";
    var shard = context.Random.Next(0, 4);
    return Task.FromResult(LoadStrikeResponse.Ok(message: $"tenant-alpha-{shard}"));
});

Stores

context.Data

Store invocation-scoped values that only need to live for the current scenario execution.

context.ScenarioInstanceData

Store per-scenario-instance shared objects created in WithInit and reused across invocations of that copy.

context.Random

Generate varied payload values with Next, NextDouble, NextBytes, and related helpers.