File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change 86
86
<PackageReference Include =" Grpc.Net.Client" Version =" 2.71.0" />
87
87
<PackageReference Include =" LiteDB" Version =" 5.0.15" />
88
88
89
- <PackageReference Include =" NBomber" Version =" 6.1.0 " />
89
+ <PackageReference Include =" NBomber" Version =" 6.1.1 " />
90
90
91
91
<PackageReference Include =" NBomber.AMQP" Version =" 0.2.1" />
92
92
<PackageReference Include =" NBomber.Data" Version =" 6.1.1" />
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 34
34
using Demo . AMQP . ClientPool ;
35
35
using Demo . AMQP . IndependentActors ;
36
36
using Demo . Features . RealtimeReporting . Datadog ;
37
+ using Demo . Features . Timeouts ;
37
38
using Demo . HTTP . RestSharpDemo ;
38
39
39
40
// -------------------------------
64
65
// new ClientPoolMqttExample().Run();
65
66
// new CliArgsExample().Run();
66
67
// new CustomMetricsExample().Run();
68
+ // new ScenarioCompletionTimeout().Run();
67
69
68
70
// ---- DataFeed ----
69
71
// new InMemoryFeed().Run();
Original file line number Diff line number Diff line change 8
8
9
9
<ItemGroup >
10
10
<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 " />
12
12
<PackageReference Include =" NBomber.Http" Version =" 6.1.0" />
13
13
<PackageReference Include =" xunit" Version =" 2.4.2" />
14
14
<PackageReference Include =" xunit.runner.visualstudio" Version =" 2.4.5" >
You can’t perform that action at this time.
0 commit comments