TestBucket.Traits.Core 1.0.5

dotnet add package TestBucket.Traits.Core --version 1.0.5
                    
NuGet\Install-Package TestBucket.Traits.Core -Version 1.0.5
                    
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="TestBucket.Traits.Core" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TestBucket.Traits.Core" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="TestBucket.Traits.Core" />
                    
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 TestBucket.Traits.Core --version 1.0.5
                    
#r "nuget: TestBucket.Traits.Core, 1.0.5"
                    
#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.
#addin nuget:?package=TestBucket.Traits.Core&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=TestBucket.Traits.Core&version=1.0.5
                    
Install as a Cake Tool

TestBucket Traits

Standardized traits and enrichment attributes for .NET unit tests.

  • Standardize properties/traits/attachments in test result files by using a shared naming convention across projects
  • Enrich output by collecting additional data from tests

Traits, Properties, Attachments

Depending on test framework (MSTest/xUnit/TUnit/NUnit..) and output formats (xunit, TRX, junitxml, CTRF etc) the attributes added by TestBucket traits may not match 1-to-1, but a generalized usage is as follows:

  • Traits: Describes traits for the test case. Often these may show up as groupings in Visual Studio, Rider or other tools. For practical reasons these should be limited.
  • Properties/Attachments: If the data is not suitable as a trait, it will be exported as a property or attachment (depending on output format).

Attributes

Attributes are named the same in both TestBucket.Traits.Xunit and TestBucket.Traits.TUnit packages to the extent possible.

xUnit

using TestBucket.Traits.Xunit;

namespace MyTests 
{
    [UnitTest]
    [EnrichedTest]
    public class MyTestClass
    {
        [Fact]
        public void MyTestMethod()
        {
        }
    }
}

TUnit

using TestBucket.Traits.TUnit;

namespace MyTests 
{
    [UnitTest]
    public class MyTestClass
    {
        [Test]
        public void MyTestMethod()
        {
        }
    }
}

Test Category

The following attributes create a TestCategory trait:

  • UnitTest
  • ApiTest
  • IntegrationTest
  • EndToEndTest

Junit XML output from xunit runner

<testcase name="A">
  <properties>
    <property name="trait:TestCategory" value="Unit" />
  </properties>
</testcase>

The xunit runner adds a trait prefix as traits are not supported in standard junitxml files

Xunit XML

<test name="A">
  <traits>
    <trait name="TestCategory" value="Unit" />
  </traits>
</test>

Enriched Tests in xUnit

The EnrichedTestAttribute adds attachments (xunit) which are key-value pairs similar to traits (but they won't show up in Visual Studio). This enables attachment traits, such as:

  • TestDescription
  • TestId
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on TestBucket.Traits.Core:

Package Downloads
TestBucket.Traits.Xunit

xunit extension with standardized traits and reporting enrichments

TestBucket.Traits.TUnit

TUnit extension with standardized traits and reporting enrichments

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 250 25 days ago
1.0.4 275 25 days ago
1.0.3 285 a month ago
1.0.2 284 a month ago
1.0.1 168 2 months ago
1.0.0 259 3 months ago