Pro.NBench.xUnit 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package Pro.NBench.xUnit --version 1.0.4
NuGet\Install-Package Pro.NBench.xUnit -Version 1.0.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="Pro.NBench.xUnit" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pro.NBench.xUnit --version 1.0.4
#r "nuget: Pro.NBench.xUnit, 1.0.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 Pro.NBench.xUnit as a Cake Addin
#addin nuget:?package=Pro.NBench.xUnit&version=1.0.4

// Install Pro.NBench.xUnit as a Cake Tool
#tool nuget:?package=Pro.NBench.xUnit&version=1.0.4

Pro.NBench.xUnit

A project to allow NBench tests to be discovered, executed, reported, and debugged using xUnit in ReSharper, and to a less polished extent, in Visual Studio Test Explorer. This allows you to not only test business logic validity, but also set performance criteria as part of your test suite.

Please refer to the Introduction to NBench as a starting point for information on how to configure NBench Tests and Measurements.

Installation

To install Pro.NBench.xUnit (Integration of NBench, xUnit and ReSharper / Visual Studio Test Explorer), run the following command in the Package Manager Console

    Install-Package Pro.NBench.xUnit

Usage

The Tests project serves as an example, and contains a set of three standard NBench test classes, attributed to collect Measurements, and Assert some conditions.

Step 1.

Disable xUnit parrallelized execution, at either the Assembly, or Collection level. In the example, this is achived by adding the following line within the project:

   [assembly: CollectionBehavior(DisableTestParallelization = true)]

Step 2.

Add a reference to the Pro.NBench.xUnit assembly, and include the following using statement for each class:

    using Pro.NBench.xUnit.XunitExtensions;

Step 3.

Include a constructor that includes a paramater of type ITestOutputHelper, and creates a new XunitTrace listener, as follows:

    public DictionaryMemoryTests(ITestOutputHelper output)
    {
        Trace.Listeners.Clear();
        Trace.Listeners.Add(new XunitTraceListener(output));
    }

Step 4.

Annotate each NBench test with the following attribute:

    [NBenchFact]

You can also use xUnit Theories, by adding:

    [NBenchTheory]

The NBench Tests will be discovered and displayed in either the Resharper or Visual Studio Test Runners.

Breakpoints in the NBench benchmarks are fully supported for debugging.

Please note, it is important that for accurate benchhmarking purposes, that the Tests are run in Release configuration, to allow compiler optimisations to be applied.

When executed using ReSharper, the Tests are displayed, with the result of NBench Assertions, and any Measurements reported by each Test.

Visual Studio Test Explorer will also execute and debug the Tests, but presentation of results is less polished.

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 netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  netstandard2.0 was computed.  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 tizen30 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on Pro.NBench.xUnit:

Package Downloads
SharpPulsar

SharpPulsar is Apache Pulsar Client built using Akka.net

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on Pro.NBench.xUnit:

Repository Stars
RicoSuter/NJsonSchema
JSON Schema reader, generator and validator for .NET
AElfProject/AElf
A scalable cloud computing blockchain platform
RicoSuter/Namotion.Reflection
.NET library with advanced reflection APIs.
Version Downloads Last updated
2.0.0 41,850 7/14/2020
1.0.5 19,569 4/16/2019
1.0.4 83,057 2/27/2018
1.0.3 9,834 7/31/2017
1.0.2 2,347 8/4/2016
1.0.1 2,042 8/4/2016
1.0.0-Pre 1,494 8/1/2016