Make Allure.Xunit compatible with Allure.Reqnroll #594
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
This allows including both
Allure.ReqnrollandAllure.Xunitin a project that has a mix of two types of tests:This works out of the box for
ReqnrollwithReqnroll.xUnit.The list of tools can be customized via the new
firstClassIntegrationToolsconfiguration property:{ "allure": { "firstClassIntegrationTools": ["MyTool"] } }The values must match the tool argument of
[GeneratedCode]:Note
The name
firstClassIntegrationToolswas chosen instead of something likeignoredToolsbecause 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.Reqnrollin your project for some reason.Closes #556