Skip to content

Commit 2017118

Browse files
committed
version 5.4.0
1 parent ab2dbfc commit 2017118

File tree

5 files changed

+34
-10
lines changed

5 files changed

+34
-10
lines changed

examples/Demo/Demo.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
<PackageReference Include="Bogus" Version="34.0.2" />
4040
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
4141
<PackageReference Include="LiteDB" Version="5.0.15" />
42-
<PackageReference Include="NBomber" Version="5.3.0" />
42+
<PackageReference Include="NBomber" Version="5.4.0" />
4343
<PackageReference Include="NBomber.Data" Version="5.0.0" />
44-
<PackageReference Include="NBomber.Http" Version="5.0.0" />
44+
<PackageReference Include="NBomber.Http" Version="5.0.1" />
4545
<PackageReference Include="NBomber.Sinks.InfluxDB" Version="5.0.1" />
4646
<PackageReference Include="MQTTnet" Version="3.1.2" />
4747
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.0" />

examples/Demo/HTTP/HttpWithTimeoutExample.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@ public void Run()
2323
.WithHeader("Content-Type", "application/json");
2424
//.WithBody(new StringContent("{ some JSON }", Encoding.UTF8, "application/json"));
2525

26-
// HttpCompletionOption: https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpcompletionoption?view=net-7.0
27-
28-
var clientArgs = new HttpClientArgs(
29-
httpCompletion: HttpCompletionOption.ResponseContentRead, // or ResponseHeadersRead
30-
cancellationToken: timeout.Token
31-
);
26+
var clientArgs = HttpClientArgs.Create(timeout.Token);
3227

3328
var response = await Http.Send(httpClient, clientArgs, request);
3429

examples/Demo/HelloWorld/HelloWorldExample.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void Run()
1717
})
1818
.WithoutWarmUp()
1919
.WithLoadSimulations(
20-
Simulation.Inject(rate: 1, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30)) // keep injecting with rate 150
20+
Simulation.Inject(rate: 150, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30)) // keep injecting with rate 150
2121
);
2222

2323
NBomberRunner
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using NBomber.CSharp;
2+
3+
namespace Demo.HelloWorld.LoadSimulation;
4+
5+
public class ScenarioTotalIterations
6+
{
7+
public void Run()
8+
{
9+
var scenario = Scenario.Create("hello_world_scenario", async context =>
10+
{
11+
await Task.Delay(1_000);
12+
13+
return Response.Ok();
14+
})
15+
.WithoutWarmUp()
16+
.WithLoadSimulations(
17+
Simulation.IterationsForConstant(copies: 50, iterations: 1000)
18+
19+
// or you can use
20+
// Simulation.IterationsForInject(rate: 50, interval: TimeSpan.FromSeconds(1), iterations: 1000)
21+
);
22+
23+
NBomberRunner
24+
.RegisterScenarios(scenario)
25+
.Run();
26+
}
27+
}

examples/Demo/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@
1818
using Demo.HTTP.SimpleBookstore;
1919

2020
// -------------------------------
21-
// -----Hello World examples -----
21+
// ----- Hello World examples -----
2222
// -------------------------------
2323
new HelloWorldExample().Run();
2424
// new ScenarioWithInit().Run();
2525
// new ScenarioWithSteps().Run();
2626
// new StepsShareData().Run();
2727
// new LoggerExample().Run();
2828

29+
// ----- Load Simulations -----
2930
// new ParallelScenarios().Run();
3031
// new ScenarioInjectRate().Run();
3132
// new ScenarioKeepConstant().Run();
3233
// new DelayedScenarioStart().Run();
34+
// new ScenarioTotalIterations().Run();
3335

3436
// new ScenarioWithTimeout().Run();
3537
// new ScenarioWithStepRetry().Run();

0 commit comments

Comments
 (0)