BddPipe 2.7.0

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

// Install BddPipe as a Cake Tool
#tool nuget:?package=BddPipe&version=2.7.0                

About BddPipe

This project was created to describe test steps. It has been developed to replace similar existing libraries as a more succinct and simpler to use alternative.

See full details on the Wiki

Goals

  • Let each step define and return to the next step all the state it needs to proceed.
  • Avoid declaring variables outside test step functions as a way to store/retreive data between steps.
  • Avoid having to set defaults for these declared variables before they are ready to be assigned.
  • Provide a way to reuse steps.
  • Have better control of output if desired - the outcome is detailed and the default console output can be captured or replaced.
  • The steps are documented in greater detail than regular tests due to the step type and title. Tests with documented steps can be easier to understand and maintain.

Getting started

Add the using statement:

using static BddPipe.Runner;

Basic example:

Scenario()
  .Given("two numbers", () => new { A = 5, B = 10 })
  .When("the numbers are summed", setup => setup.A + setup.B)
  .Then("sum should be as expected", result =>
  {
    Assert.AreEqual(15, result);
  })
  .Run();

Steps must end with a call to .Run() or the result is not evaluated.

Scenario:

It is optional to start with Scenario() for a scenario describing your method name, or Scenario("Your scenario title")

// This example will use the method name in the output
Scenario()
    .Given(...)

// This example will use "Your scenario title" in the output
Scenario("Your scenario title")
    .Given(...)

The scenario will then be at the top of the test output:

Scenario: Your scenario title  
  Given two numbers [Passed]  
  When the numbers are summed [Passed]  
  Then sum should be as expected [Passed]  

There are a number of overloads for the method steps: Given, When, Then, And, But.

When implementing steps, you can return from them whatever you like - including anonymous types or tuples. If something is returned from one of these steps then all following steps using a parameter will have a parameter of this instance, until a different instance is returned from a step. This also allows Action steps to be placed between the step returning something and the step that will later make use of it.

Async:

Async steps can be provided via an async delegate implementation - you can provide a method returning Task or Task<T>:

When("The numbers are summed", async args =>
{
    await Task.Delay(10);
    return new { Result = args.A + args.B };
})

Output:

By default the output is written to console. Each step will be marked as passed, failed, inconclusive or not run. Steps after a failed or inconclusive step will not be run.

Given two numbers [Passed]  
When the numbers are summed [Passed]  
Then sum should be as expected [Passed]  

You can instead be given this output by supplying an action to the final Run() call. This will no longer console write the output by default and will give the result to your implementation.

.Run(output => { /*handle output*/ });

It's still possible to call Runner.WriteLogsToConsole(...) from your implementation to use the default console logging.

You can also get the details of the output from the result of the final Run() call as an instance of BddPipeResult<T>.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.7.0 30,453 10/29/2022
2.6.0 4,023 5/14/2022
2.5.0 3,772 3/27/2022
2.4.0 3,034 10/18/2021
2.3.0 4,833 6/26/2021
2.2.0 12,373 3/1/2020
2.1.1 490 2/23/2020
2.1.0 2,850 2/6/2020
2.0.0 1,178 1/27/2020