NBomber plugin for defining HTTP scenarios
To install NBomber.Http via NuGet, run this command in NuGet package manager console:
PM> Install-Package NBomber.Http
Documentation is located here
Would you like to help make NBomber even better? We keep a list of issues that are approachable for newcomers under the good-first-issue label.
// FSharp example
let httpFactory = HttpClientFactory.create()
let step = Step.create("simple step", clientFactory = httpFactory, execute = fun context ->
Http.createRequest "GET" "https://nbomber.com"
|> Http.withHeader "Accept" "text/html"
|> Http.send context
)
Scenario.create "test_nbomber" [step]
|> Scenario.withLoadSimulations [InjectPerSec(rate = 100, during = seconds 30)]
|> NBomberRunner.registerScenario
|> NBomberRunner.run
// CSharp example
var httpFactory = HttpClientFactory.Create();
var step = Step.Create("simple step", clientFactory: httpFactory, execute: async context =>
{
var request = Http.CreateRequest("GET", "https://nbomber.com")
.WithHeader("Accept", "text/html");
var response = await Http.Send(request, context);
return response;
});
var scenario = ScenarioBuilder
.CreateScenario("test_nbomber", step)
.WithLoadSimulations(Simulation.InjectPerSec(100, TimeSpan.FromSeconds(30)));
NBomberRunner
.RegisterScenarios(scenario)
.Run();