I just came across this very nice load testing tool for .NET and I wrote my first code:
var connectStep = Step.Create("ConnectReceive", async context =>
{
Console.WriteLine("Step was executed.");
return Response.Ok();
});
var scenario = ScenarioBuilder.CreateScenario("LotsOfConnections", connectStep)
.WithLoadSimulations(Simulation.KeepConstant(copies: 1, during: TimeSpan.FromSeconds(10)));
NBomberRunner.RegisterScenarios(scenario).Run();
However when I run this I see Step was executed hundreds of times in my console screen.
I specified copies: 1, during: TimeSpan.FromSeconds(10) so based on my understanding it should only run once within a period of 10 seconds.
why is it running numerous times
According to this Load Simulations Intro sample, "
KeepConstantruns a fixed number of scenario copies (threads) and executes as many iterations as possible for a specified amount of time."It's not exactly clear what the scenario is that you want.
Do you want it to just run once, but take 10 seconds? If so, you could add a step to the scenario that sleeps for 10 seconds after the connect step, and remove the
.WithLoadSimulationsfrom the scenario.Do you want the scenario to run many times, but only once every 10 seconds? If so, you could add a step to the scenario that sleeps for 10 seconds after the connect step, and then add a longer duration to the load simulation:
For example: