allure-framework / allure-framework/allure-csharp
Pick up xunit fixtures automatically
- Dominant language
- C#
- Stars
- 125
- Forks
- 76
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 18
Description
Currently, to make fixtures appears in the report, a user has to apply `[AllureBefore]` or `[AllureAfter]` to constructors and/or `Dispose` methods. Moreover, a correct attribute should be used, otherwise the fixture goes to the wrong section of the report.
This seems redundant. Ideally, we should pick the fixtures up automatically. In other words, this:
```csharp
using Xunit;
public class TestClass : IDisposable
{
public TestClass() {}
[Fact]
public void TestMethod(){}
public void Dispose() {}
}
```
should produce the same report as this:
```csharp
using Allure.XUnit.Attributes.Steps;
using Xunit;
public class TestClass : IDisposable
{
[AllureBefore]
public TestClass() {}
[Fact]
public void TestMethod(){}
[AllureAfter]
public void Dispose() {}
}
```

### Motivation
1. Improve the out-of-box experience.
2. Put allure-xunit more in line with other allure integrations.
### Consideration
The following should be supported to not take away features, users already have:
1. Specify a custom name of a fixture (via a new single attribute that replaces `[AllureBefore]` and `[AllureAfter]`, a special attribute like `[AllureTitle]` or `[AllureName]` or, probablty, a built-in `[DisplayName]`).
2. Provide an ability to exclude a fixture from the report for those who prefer to hide some technical fixtures (again, via a new abovementioned attribute or something like `[AllureIgnore]` or maybe other means).
#### Backward compatibility
`[AllureBefore]` and `[AllureAfter]` should still be supported (although, marked as obsolete).
Contributor guide
Research direction
Start by tracing how allure-xunit currently handles [AllureBefore] and [AllureAfter] for constructors and Dispose methods. Define automatic fixture discovery while preserving custom names, exclusion, and backward compatibility; done means the C# example produces the same report without those attributes and existing attributed fixtures still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100