UBehave 0.9.3

dotnet add package UBehave --version 0.9.3
                    
NuGet\Install-Package UBehave -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="UBehave" Version="0.9.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UBehave" Version="0.9.3" />
                    
Directory.Packages.props
<PackageReference Include="UBehave" />
                    
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 UBehave --version 0.9.3
                    
#r "nuget: UBehave, 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 UBehave@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=UBehave&version=0.9.3
                    
Install as a Cake Addin
#tool nuget:?package=UBehave&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 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.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

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 148 7/24/2026
0.9.2 203 4/8/2026
0.9.1 124 3/2/2026
0.9.0 127 3/2/2026