Skip to content

Commit

Permalink
version 5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AntyaDev committed Dec 2, 2023
1 parent ab2dbfc commit 2017118
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/Demo/Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
<PackageReference Include="LiteDB" Version="5.0.15" />
<PackageReference Include="NBomber" Version="5.3.0" />
<PackageReference Include="NBomber" Version="5.4.0" />
<PackageReference Include="NBomber.Data" Version="5.0.0" />
<PackageReference Include="NBomber.Http" Version="5.0.0" />
<PackageReference Include="NBomber.Http" Version="5.0.1" />
<PackageReference Include="NBomber.Sinks.InfluxDB" Version="5.0.1" />
<PackageReference Include="MQTTnet" Version="3.1.2" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.0" />
Expand Down
7 changes: 1 addition & 6 deletions examples/Demo/HTTP/HttpWithTimeoutExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ public void Run()
.WithHeader("Content-Type", "application/json");
//.WithBody(new StringContent("{ some JSON }", Encoding.UTF8, "application/json"));
// HttpCompletionOption: https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpcompletionoption?view=net-7.0
var clientArgs = new HttpClientArgs(
httpCompletion: HttpCompletionOption.ResponseContentRead, // or ResponseHeadersRead
cancellationToken: timeout.Token
);
var clientArgs = HttpClientArgs.Create(timeout.Token);
var response = await Http.Send(httpClient, clientArgs, request);
Expand Down
2 changes: 1 addition & 1 deletion examples/Demo/HelloWorld/HelloWorldExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void Run()
})
.WithoutWarmUp()
.WithLoadSimulations(
Simulation.Inject(rate: 1, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30)) // keep injecting with rate 150
Simulation.Inject(rate: 150, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30)) // keep injecting with rate 150
);

NBomberRunner
Expand Down
27 changes: 27 additions & 0 deletions examples/Demo/HelloWorld/LoadSimulation/ScenarioTotalIterations.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using NBomber.CSharp;

namespace Demo.HelloWorld.LoadSimulation;

public class ScenarioTotalIterations
{
public void Run()
{
var scenario = Scenario.Create("hello_world_scenario", async context =>
{
await Task.Delay(1_000);
return Response.Ok();
})
.WithoutWarmUp()
.WithLoadSimulations(
Simulation.IterationsForConstant(copies: 50, iterations: 1000)

// or you can use
// Simulation.IterationsForInject(rate: 50, interval: TimeSpan.FromSeconds(1), iterations: 1000)
);

NBomberRunner
.RegisterScenarios(scenario)
.Run();
}
}
4 changes: 3 additions & 1 deletion examples/Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
using Demo.HTTP.SimpleBookstore;

// -------------------------------
// -----Hello World examples -----
// ----- Hello World examples -----
// -------------------------------
new HelloWorldExample().Run();
// new ScenarioWithInit().Run();
// new ScenarioWithSteps().Run();
// new StepsShareData().Run();
// new LoggerExample().Run();

// ----- Load Simulations -----
// new ParallelScenarios().Run();
// new ScenarioInjectRate().Run();
// new ScenarioKeepConstant().Run();
// new DelayedScenarioStart().Run();
// new ScenarioTotalIterations().Run();

// new ScenarioWithTimeout().Run();
// new ScenarioWithStepRetry().Run();
Expand Down

0 comments on commit 2017118

Please sign in to comment.