NBomber.FSharp 0.0.5

dotnet add package NBomber.FSharp --version 0.0.5                
NuGet\Install-Package NBomber.FSharp -Version 0.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NBomber.FSharp" Version="0.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NBomber.FSharp --version 0.0.5                
#r "nuget: NBomber.FSharp, 0.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NBomber.FSharp as a Cake Addin
#addin nuget:?package=NBomber.FSharp&version=0.0.5

// Install NBomber.FSharp as a Cake Tool
#tool nuget:?package=NBomber.FSharp&version=0.0.5                

NBomber.FSharp

F# Computation Expressions for NBomber API

Package Description Status
NBomber.FSharp CE for test runners, scenarios and steps NBomber.FSharp
NBomber.FSharp.Http CE for http calls steps, similar to NBomber.Plugins.Http NBomber.FSharp.Http
NBomber.FSharp.Hopac Hopac support for the above, depends on both NBomber.FSharp.Hopac

Build history

Scenario

<table> <tbody> <thead><tr><th>Fluent API</th><th>Computation Expression</th></tr></thead> <tr><td>

Scenario.create "test" [step]
|> Scenario.withWarmUp (seconds 10)
|> Scenario.withLoadSimulations [
    KeepConstant(copies = copiesCount, during = seconds 2)
]

</td><td>

scenario "test" {
    warmUp (seconds 10)
    load [
        KeepConstant(copies = copiesCount, during = seconds 2)
    ]
    init (fun _ -> Task.FromResult())
    clean (fun _ -> Task.FromResult())
    steps [myStep]
    // or if just one step
    myStep
}

</td></tr> </tbody></table>

Step

The overloads of step's custom operation execute accepts a function taking a step context and returning either Response or unit directly or wrapped in a task, async or even in a Hopac job <table> <tbody> <thead><tr><th>Fluent API</th><th>Computation Expression</th></tr></thead> <tr><td>

Step.create("step name",
    myWebsocketPool,
    myGuidFeed,
    (fun ctx -> task {
        let doSomethingWithSocket (_: Guid) (_: ClientWebSocket) =
            ""
        ctx.Logger.Information("Can take feed and client {Ret}",
            takeBoth ctx.FeedItem ctx.Client)
        return Response.Ok()
    }), true)

</td><td>

step "step name" {
    dataFeed myGuidFeed
    myWebsocketPool
    execute (fun ctx ->
        let doSomethingWithSocket (_: Guid) (_: ClientWebSocket) =
            ""
        ctx.Logger.Information("Can take feed and client {Ret}",
            takeBoth ctx.FeedItem ctx.Client) )
    doNotTrack
}

</td></tr> </tbody></table>

Client factory

Simplified construction of clients. Notable differences are:

  • connect and disconnect functions are more tolerant for missing type signatures and arguments
  • no need for cancellationToken argument if it is not used in connect or disconnect functions
  • disconnect can be omitted completely, if the type of created connection implements IDisposable or can be just disposed.
  • count of connections can be omitted too, it defaults to 1
  • even less verbose compared to the C# API

<table> <tbody> <thead><tr><th>Fluent API</th><th>Computation Expression</th></tr></thead> <tr><td>


let clientFactory =
    ClientFactory.create(
        name = "db connections",
        initClient = (fun i ctx -> task {
            let c = new NpgsqlConnection(connectionString)
            do! c.OpenAsync(ctx.CancellationToken)
            return c
        }),
        disposeClient = (fun (c:NpgsqlConnection, ctx) -> c.CloseAsync(ctx.CancellationToken)),
        clientCount = 100)

</td><td>

let clientFactory =
    clients "db connections" {
        count 100
        connect(fun i ctx -> task {
            let c = new NpgsqlConnection(connectionString)
            do! c.OpenAsync(ctx.CancellationToken)
            return c
        })
        disconnect(fun c ctx -> c.CloseAsync(ctx.CancellationToken))
    }

</td></tr> </tbody></table>

Reporter

Imagine you need just a html report. Then it is as short as

report { html }

<table> <tbody> <thead><tr><th>Fluent API</th><th>Computation Expression</th></tr></thead> <tr><td>

    NBomberRunner.withReportFormats [
        ReportFormat.Csv
        ReportFormat.Txt
        ReportFormat.Md
        ReportFormat.Html
    ]
    |> NBomberRunner.withReportingSinks
        [ influxdbSink
          customFormatSink ]
        (seconds 10)
    |> NBomberRunner.withReportFolder "reportsFolder"
    |> NBomberRunner.withReportFileName "reportFile"
    // or if none
    |> NBomberRunner.withoutReports
    ...

</td><td>

    testSuite "Suite name" {
        report {
            csv
            text
            markdown
            html
            sink influxdbSink
            sink customFormatSink
            interval (seconds 10)
            folderName "reportsFolder"
            fileName "reportFile"
        }
        // or if none
        noReports

        ...
    }

</td></tr> </tbody></table>

Other runner configuration

<table> <tbody> <thead><tr><th>Fluent API</th><th>Computation Expression</th></tr></thead> <tr><td>

NBomberRunner.registerScenarios []
|> NBomberRunner.withTestName "Test name"
|> NBomberRunner.withTestSuite "Suite name"
|> NBomberRunner.withoutReports
|> NBomberRunner.disableHintsAnalyzer
|> NBomberRunner.loadConfig "loadTestConfig.json"
|> NBomberRunner.loadInfraConfig "infrastructureConfig.json"
|> NBomberRunner.withWorkerPlugins []
|> NBomberRunner.withApplicationType ApplicationType.Console
// |> NBomberRunner.runWithArgs args
|> NBomberRunner.run
|> evaluateStatsFunction

</td><td>

testSuite "Suite name" {
    testName "Test name"
    noReports
    noHintsAnalyzer
    scenarios scenarioBuilderTest
    config "loadTestConfig.json"
    infraConfig "infrastructureConfig.json"
    plugins [ (* plugins list*) ]
    runConsole
    // runAsProcess
    // runWithArgs args
    // runWithExitCode
}

</td></tr> </tbody></table>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on NBomber.FSharp:

Package Downloads
NBomber.FSharp.Http

F# extensions for NBomber.Http

NBomber.FSharp.Hopac

F# extensions for using Hopac with NBomber

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.5 10,529 11/12/2021
0.0.4 1,334 5/28/2021
0.0.3 1,413 5/17/2021
0.0.3-b 988 3/8/2021
0.0.2 1,585 11/11/2020
0.0.1 1,539 11/7/2020

- update to NBomber 2.1.2