allure-framework / allure-framework/allure-csharp

Add support for class and collection xunit fixtures

Open
#360 0 comments 0 reactions 0 assignees View on GitHub
task:new feature theme:xunit
Dominant language
C#
Stars
125
Forks
76
Avg merge
1d 2h
Merged PRs (30d)
18

Description

Currently, there is no way to include a class- or collection-scoped fixture to a report produced by allure-xunit. They neither appear automatically nor could be included by `[AllureBefore]` or `[AllureAfter]` (applying the attributes causes the `Value cannot be null` error).

### Expected behavior

The following code:

```csharp
using Xunit;
using System;

public class ClassFixture : IDisposable
{
public ClassFixture(){}

public void Dispose(){}
}

public class CollectionFixture : IDisposable
{
public CollectionFixture(){}

public void Dispose(){}
}

[CollectionDefinition("My xunit collection")]
public class MyCollection : ICollectionFixture{}

[Collection("My xunit collection")]
public class TestClass : IClassFixture
{
public TestClass(ClassFixture _1, CollectionFixture _2){}

[Fact]
public void TestMehtod(){}
}
```

should produce the following report:

![image](https://github.com/allure-framework/allure-csharp/assets/132977515/9f531351-2c0a-4d0e-a043-87fc0b4255fb)

### Motivation

High-scope fixtures are important test framework constructs and ideally should be supported by allure out-of-box for all frameworks.

### Other considerations

1. There should be a way to exclude a fixture from the report
2. There should be a way to assign a custom name to a fixture (on a class or method levels)

See also #353.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how allure-xunit currently discovers and reports fixtures, using the supplied class- and collection-fixture example as the behavioral reference. Review the related discussion in #353; done means those fixtures appear in the report without the null error, with the requested exclusion and custom-naming behavior clarified.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.