This document will help you learn about NBomber.HTTP plugin in more detail.
The NBomber.Http provides a simple API to define HTTP steps, handle responses in an efficient way (without waiting on full response body but rather first bytes), calculate response size, apply assertions.
Add HTTP package
Create HTTP load test
The main thing that this plugin adds is a convenient way to define the NBomber step that creates a Http request and then sends it.
By default NBomber.Http is set completionOption = HttpCompletionOption.ResponseHeadersRead for performance optimizations. You can read about this optimization here.
By default NBomber sets no headers.
By default, NBomber is using this check for every response but you can override it for every step.
Here you can find a full example using all API functions.
There may be situations when you need to trace your requests and responses. The NBomber.Http has built-in functionality for tracing every request/response. In order to start tracing you need to set minimum logging level to verbose.
Make sure that you always return a new instance (not from a variable) of LoggerConfiguration. This limitation is mandatory since Serilog logger does not allow to create multiple instances from the same instance of LoggerConfiguration.
To work with the JSON format, you can use any library you prefer. Here is a list of popular libraries:
- To test HTTP use LoadSimulation.InjectPerSec since usually web server is an open system. You can read more here.
- For debugging or tracing you can use LoadSimulation.KeepConstant with copies = 1 since for this simulation NBomber will use a single task which is easier to debug.
- Use Ping plugin to get more info about networking.