Skip to content

Conversation

@delatrie
Copy link
Contributor

@delatrie delatrie commented Oct 14, 2025

Context

Allure.Xunit reports all xUnit.net tests in the project automatically, which interferes with Allure.Reqnroll or 3rd-party integrations with tools that use xUnit.net as a runner.

Usually, when such tools generate test classes, they apply [GeneratedCode] to them. The first argument of the attribute identifies the tool that has generated the class.

The PR benefits from this fact by making Allure.Xunit checks the [GeneratedCode] attributes of a test class against the list of tools that are known to have a specific Allure integration. If it finds the class has been generated by such a tool, it ignores all tests defined in the class.

By default, the list includes two tools:

  • Reqnroll
  • TechTalk.SpecFlow

This allows including both Allure.Reqnroll and Allure.Xunit in a project that has a mix of two types of tests:

  • xUnit.net
  • Reqnroll features that are run using the xUnit.net runner

This works out of the box for Reqnroll with Reqnroll.xUnit.

The list of tools can be customized via the new firstClassIntegrationTools configuration property:

{
  "allure": {
    "firstClassIntegrationTools": ["MyTool"]
  }
}

The values must match the tool argument of [GeneratedCode]:

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("MyTool", "1.0.0.0")]
public class TestClassGeneratedByMyTool
{
    // test methods...
}

Note

The name firstClassIntegrationTools was chosen instead of something like ignoredTools because it makes more sense in the context of a configuration file shared by two Allure integrations, each responsible for their own set of xUnit.tests they consider "first class".

Note

Setting the property to an empty array will force Reqnroll tests to be reported by Allure.Xunit. It's not recommended, but it works if you can't use Allure.Reqnroll in your project for some reason.

Closes #556

@delatrie delatrie changed the title Make Allure.Xunit compatible with Allure.Reqnroll feat(xunit,reqnroll): Allure.Xunit compatibility with Allure.Reqnroll Oct 16, 2025
@delatrie delatrie changed the title feat(xunit,reqnroll): Allure.Xunit compatibility with Allure.Reqnroll Make Allure.Xunit compatible with Allure.Reqnroll Oct 16, 2025
@delatrie delatrie merged commit 0028c20 into main Oct 16, 2025
7 checks passed
@delatrie delatrie deleted the xunit-reqnroll-compat branch October 16, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running two nugets Allre.Reqnroll and Allure.Xunit together

3 participants