BunsenBurner 6.2.4

dotnet add package BunsenBurner --version 6.2.4
NuGet\Install-Package BunsenBurner -Version 6.2.4
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="BunsenBurner" Version="6.2.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BunsenBurner --version 6.2.4
#r "nuget: BunsenBurner, 6.2.4"
#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 BunsenBurner as a Cake Addin
#addin nuget:?package=BunsenBurner&version=6.2.4

// Install BunsenBurner as a Cake Tool
#tool nuget:?package=BunsenBurner&version=6.2.4

Bunsen Burner Bunsen Burner Core

Nuget

This provides the core dependency free test abstraction that Bunsen Burner is built on.

Getting Started

To use this library, simply include BunsenBurner.dll in your project or grab it from NuGet, and add this to the top of each test .cs file that needs it:

using static BunsenBurner.Aaa; // For Arrange act assert

or

using static BunsenBurner.Bdd; // For Given when then

What?

The type that makes this library possible is a Scenario.

This is an ADT that models a single test. It has the following structure,

Scenario<
 // Supported Syntax, either arrange act assert (Aaa) or given when then (Bdd)
    TSyntax
>.(
 // Scenario that has been arranged and is ready to act on, returning a TData   
    Arranged<TData> | 
 // Scenario that has been acted on, taking a TData returning a TResult and is 
 // ready to assert against 
    Acted<TData, TResult> | 
 // Scenario that is asserted against a TResult. This can be run.
    Asserted<TData, TResult>)

This structure represents a lazy asynchronous immutable test that can be composed and later run.

The aim is for the type parameters to be fully inferable. There are a few edge cases to this, but the core abstractions require no provided type parameters.

How to use

To start using it import either the Aaa or Bdd syntax and start composing the test.

Arrange, Act, Assert

using static BunsenBurner.Aaa;

[Fact(DisplayName = "Some simple test")]
public async Task Case1() =>
  await Arrange(() => 1)
      .And(x => x.ToString())
      .Act(x => x.Length)
      .And((_, r) => r + 1)
      .Assert((_, r) => Assert.Equal(2, r));

Given, When, Then

using static BunsenBurner.Bdd;

[Fact(DisplayName = "Some simple test")]
public async Task Case1() =>
  await Given(() => 1)
      .And(x => x.ToString())
      .When(x => x.Length)
      .And((_, r) => r + 1)
      .Then((_, r) => Assert.Equal(2, r));

The test is run using a custom awaiter, so async await is required.

Also as the pipeline is fully async, you need to always await a Scenario, even if all your components are synchronous.

Benefits

  • Standardised - All tests are built on the same abstraction, it can model any test,
    • Must be composed in the correct sequence
      • Arrange/Given
      • Act/When
      • Assert/Then
    • And steps can be used between to allow for transformations
  • Data driven - Scenarios are just data, can be passed to and from functions, can be put in a list, assigned to variables
  • Composable - Both within a single test and over multiple tests
    • Write custom extension methods to extend the syntax in any direction, with the comfort of knowing it will make sure the developer uses it correctly. Just look at the other libraries provided for inspiration
    • Functional first, its just data with functions that operate on that data
  • Readable - Enforced structures with no easy way to shoot yourself in the foot, should result in code that is easier to maintain and read
  • Simple - 1 data type, and functions that operate on it
  • Flexible
    • No dependencies
    • No assumptions around test frameworks
    • No assumptions around SUT
    • No requirements on the user code
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.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (12)

Showing the top 5 NuGet packages that depend on BunsenBurner:

Package Downloads
BunsenBurner.Http

Extension methods for testing Http servers

BunsenBurner.Verify.Xunit

Integration with [Verify.Xunit](https://github.com/VerifyTests/Verify) to simplify assert steps

BunsenBurner.AutoFixture

Integration with [AutoFixture](https://github.com/AutoFixture) to simplify arrange steps

BunsenBurner.BenchmarkDotNet

Integration with [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) to write performance tests

BunsenBurner.Bogus

Integration with [Bogus](https://github.com/bchavez/Bogus) to simplify arrange steps

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
6.2.4 6,704 6/20/2023
6.2.3 1,343 6/5/2023
6.2.2 3,334 4/25/2023
6.2.1 3,738 3/11/2023
6.2.0 2,658 1/29/2023
6.1.1 3,132 1/19/2023
6.1.0 4,231 1/12/2023
6.0.0 2,432 1/11/2023
5.3.1 2,509 1/7/2023
5.3.0 2,472 1/6/2023
5.2.0 2,586 12/17/2022
5.1.0 2,862 12/12/2022
5.0.0 2,547 12/11/2022
4.0.1 2,533 12/11/2022
4.0.0 2,554 12/11/2022
3.0.0 2,538 12/10/2022
2.2.0 2,534 12/9/2022
2.1.0 2,495 12/9/2022
2.0.0 2,613 12/9/2022
1.6.2 2,896 12/2/2022
1.6.1 2,832 12/1/2022
1.6.0 2,759 11/30/2022
1.5.1 2,910 11/26/2022
1.5.0 2,861 11/21/2022
1.4.1 2,268 11/19/2022
1.4.0 2,183 11/19/2022
1.3.0 2,063 11/19/2022
1.2.1 1,894 11/17/2022
1.2.0 1,968 11/16/2022
1.1.1 2,006 11/15/2022
1.1.0 1,899 11/15/2022
1.0.4 1,617 11/8/2022
1.0.3 1,745 11/6/2022
1.0.2 1,758 11/6/2022
1.0.1 1,754 11/6/2022
1.0.0 1,754 11/6/2022