Skip to main content
.NETCoreApp2.0net5.0net6.0.NETStandard2.1

Allure.XUnit

Published
Jul 27, 2022
4y ago
Total Downloads
1.6M
1,579,272

Install

dotnet add package Allure.Xunit --version 2.9.1-preview.6-nunit-fixtures
ProductVersions
.NET
net5.0net6.0
.NET Standard
netstandard2.1
Other
.NETCoreApp2.0

README

Allure.XUnit

Nuget

Allure.XUnit is library for display xunit tests in Allure report.

Allure.XUnit supports .NET Core 2.0 and later.

Attributes:

  • AllureXunit
  • AllureDescription
  • AllureParentSuite
  • AllureFeature
  • AllureTag
  • AllureSeverity
  • AllureIssue
  • AllureOwner
  • AllureSuite
  • AllureSubSuite
  • AllureLink
  • AllureEpic
  • AllureLabel
  • AllureId
  • AllureXunitTheory - attribute for display parametrized tests. Use InlineData, MemberData, ClassData, XUnit attributes for pass parameters.

All methods have to be tagged by attribute AllureXunit instead of Fact, or AllureXunitTheory instead of Theory for display in allure report. Other attributes are optional.

Attributes usage

Most of the attributes can be used both on methods and classes.

Attribute Method Class
AllureXunit x
AllureDescription x
AllureParentSuite x x
AllureFeature x x
AllureTag x x
AllureSeverity x x
AllureIssue x x
AllureOwner x x
AllureSuite x x
AllureSubSuite x x
AllureLink x x
AllureEpic x x
AllureLabel x x
AllureXunitTheory x
AllureId x

To override attribute value you can use overwrite param in attribute definition. In other case multiple values will be written in test results.

Example:

[AllureSuite("Suite A")]
public class TestClass
{
    [AllureXunit(DisplayName = "Test Name")]
    [AllureSuite("Suite B", overwrite: true))]
    public void TestMethod
    {
    }
}

Steps

Use AllureStepAttribute, AllureBeforeAttribute, AllureAfterAttribute

See Examples.

Allure.XUnit.StepExtensions deprecation

There is no more need to use separate Allure.XUnit.StepExtensions package - you can simple remove it from dependencies and use attributes from Allure.XUnit.Attributes.Steps namespace directly.

using Allure.XUnit.Attributes.Steps;

...

    [AllureStep("Check that {someNumber} is the answer to life, the universe, and everything")]
    private void NestedStep([Name("number")] int someNumber, [Skip] bool skippedBoolean = true)
    {
        Assert.Equal(42, someNumber);
    }

Attachments

Use AllureAttachments class with it's methods. (AttachmentAttribute coming soon)

Running

Just run dotnet test.

allure-results directory with result appears after running tests in target directory.

Examples

See Examples

Changes from Previous Version

No structural changes between v2.9.1-preview.5 and v2.9.1-preview.6-nunit-fixtures.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 4 target frameworks; confirm the exact target used by your application.The published metadata declares 20 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.