Skip to content

Commit 91ebad3

Browse files
committed
version 6.1.1
1 parent 439e1fd commit 91ebad3

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

examples/Demo/Demo.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
8787
<PackageReference Include="LiteDB" Version="5.0.15" />
8888

89-
<PackageReference Include="NBomber" Version="6.1.0" />
89+
<PackageReference Include="NBomber" Version="6.1.1" />
9090

9191
<PackageReference Include="NBomber.AMQP" Version="0.2.1" />
9292
<PackageReference Include="NBomber.Data" Version="6.1.1" />
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using NBomber.CSharp;
2+
3+
namespace Demo.Features.Timeouts;
4+
5+
public class ScenarioCompletionTimeout
6+
{
7+
public void Run()
8+
{
9+
// Docs: https://nbomber.com/docs/nbomber/timeouts
10+
11+
// When NBomber finishes load tests, it waits for all running scenarios to complete their tasks.
12+
13+
var scenario = Scenario.Create("scenario_1", async context =>
14+
{
15+
await Task.Delay(8_000); // set 8 sec, but the duration of the scenario is only 1 sec.
16+
return Response.Ok();
17+
})
18+
.WithoutWarmUp()
19+
.WithLoadSimulations(Simulation.KeepConstant(copies: 1, during: TimeSpan.FromSeconds(1))); // set 1 sec duration
20+
21+
var result =
22+
NBomberRunner
23+
.RegisterScenarios(scenario)
24+
.WithScenarioCompletionTimeout(TimeSpan.FromSeconds(10)) // we set 10 sec to wait
25+
.Run();
26+
27+
Console.WriteLine(result.AllOkCount == 1
28+
? "Scenario completed"
29+
: "Scenario not completed"
30+
);
31+
}
32+
}

examples/Demo/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
using Demo.AMQP.ClientPool;
3535
using Demo.AMQP.IndependentActors;
3636
using Demo.Features.RealtimeReporting.Datadog;
37+
using Demo.Features.Timeouts;
3738
using Demo.HTTP.RestSharpDemo;
3839

3940
// -------------------------------
@@ -64,6 +65,7 @@
6465
// new ClientPoolMqttExample().Run();
6566
// new CliArgsExample().Run();
6667
// new CustomMetricsExample().Run();
68+
// new ScenarioCompletionTimeout().Run();
6769

6870
// ---- DataFeed ----
6971
// new InMemoryFeed().Run();

examples/xUnitExample/xUnitExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<ItemGroup>
1010
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
11-
<PackageReference Include="NBomber" Version="6.1.0" />
11+
<PackageReference Include="NBomber" Version="6.1.1" />
1212
<PackageReference Include="NBomber.Http" Version="6.1.0" />
1313
<PackageReference Include="xunit" Version="2.4.2" />
1414
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

0 commit comments

Comments
 (0)