PragmaticFlow / NBomber

Modern and flexible load testing framework for Pull and Push scenarios, designed to test any system regardless a protocol (HTTP/WebSockets/AMQP etc) or a semantic model (Pull/Push).
https://nbomber.com
Other
2.08k stars 129 forks source link

Add Get/Find/Exist extensions for Stats types that work without allocations #742

Closed AntyaDev closed 2 months ago

AntyaDev commented 2 months ago

Documentation link

// gets scenario stats: 
// it throws exception if "scenario_1" is not found 
var scnStats1 = result.ScenarioStats.Get("scenario_1");

// finds scenario stats: 
// it returns null if "scenario_2" is not found 
var scnStats2 = result.ScenarioStats.Find("scenario_2");

// check that step "login" exist in the list
bool isLoginExist = scnStats.StepStats.Exists("login");

// check that status code "503" exist in the list
bool isExist = scnStats.Fail.StatusCodes.Exists("503");

// get stats of status code "503"
// in case of status not found, the exception will be thrown
var statusCode = scnStats.Fail.StatusCodes.Get("503");