NuBehave 0.9.3

dotnet add package NuBehave --version 0.9.3
                    
NuGet\Install-Package NuBehave -Version 0.9.3
                    
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="NuBehave" Version="0.9.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NuBehave" Version="0.9.3" />
                    
Directory.Packages.props
<PackageReference Include="NuBehave" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NuBehave --version 0.9.3
                    
#r "nuget: NuBehave, 0.9.3"
                    
#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.
#:package NuBehave@0.9.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NuBehave&version=0.9.3
                    
Install as a Cake Addin
#tool nuget:?package=NuBehave&version=0.9.3
                    
Install as a Cake Tool

UBehave

A micro-library for writing BDD-style tests in C#. Inspired by xBehave.net.

Nuget packages:

The goal it to write behavior tests first, and then implement the code to make the tests pass. Which is mainly useful for integration testing, but you're free to use in anywhere.

Quickstart

In your xUnit or NUnit-Project, add a reference to UBehave or NuBehave and write your first test:


public class Calculator
{
    public int Add(int x, int y) => x + y;
}

public class CalculatorFeature
{
    [Scenario("A user wants to calculate an addition")]
    public async Task Addition()
    {
        // Given
        var calculator = new Calculator();
        var x = 1;
        var y = 2;

        // When
        await $"When I add the numbers {x} + {y} together"
            .x(() => calculator.Add(x, y))
            .Out(out var result);

        // Then
        await "Then the answer is 3"
            .x(() => Assert.Equal(3, result.x));
    }
}

Output:

STEP START: 'When I add the numbers 1 + 2 together'
STEP END: 'When I add the numbers 1 + 2 together' took 00:00:00.0001873
-----------------------------------------------------------------------

STEP START: 'Then the answer is 3'
STEP END: 'Then the answer is 3' took 00:00:00.0058363
------------------------------------------------------

Step by step

In BDD-Style, you write your tests first from a user perspective, and then implement the code step by step to make the tests pass. So you start with simple describing test method:

    [Scenario("A user wants to request the weather")]
    public async Task Addition()
    {
        // Given
        await "Given a running ASP IntegrationTesting Server"
            .Todo();        

        // When
        await "When I ask the weather for tomorrow"
            .Todo();

        // Then
        await "Then the answer is sunny, 20°C"
            .Todo();
    }
}

From here on you can implement the code step by step, and make the tests pass.

Even though not neccessary, UBehave ❤️ to be combinated with ASP System under test and Test Containers 🎉<br> And it doesn't matter if you call it 'You Behave' or 'Micro-Behave/µBehave'. It's a bit of both.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.9.3 132 7/24/2026
0.9.2 146 4/8/2026
0.9.1 124 3/2/2026
0.9.0 133 3/2/2026