-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
31 lines (25 loc) · 918 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// See https://aka.ms/new-console-template for more information
using NBomber.Contracts;
using NBomber.CSharp;
using NBomber.Plugins.Http.CSharp;
using NBomber.Plugins.Network.Ping;
var step = Step.Create("fetch_html_page",
clientFactory: HttpClientFactory.Create(),
execute: context =>
{
var request = Http.CreateRequest("GET", "https://nbomber.com")
.WithHeader("Accept", "text/html");
return Http.Send(request, context);
});
var scenario = ScenarioBuilder
.CreateScenario("simple_http", step)
.WithWarmUpDuration(TimeSpan.FromSeconds(5))
.WithLoadSimulations(
Simulation.InjectPerSec(rate: 100, during: TimeSpan.FromSeconds(30))
);
var pingPluginConfig = PingPluginConfig.CreateDefault(new[] {"nbomber.com"});
var pingPlugin = new PingPlugin(pingPluginConfig);
NBomberRunner
.RegisterScenarios(scenario)
.WithWorkerPlugins(pingPlugin)
.Run();