Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for class and collection xunit fixtures #360

Open
delatrie opened this issue Jun 19, 2023 · 0 comments
Open

Add support for class and collection xunit fixtures #360

delatrie opened this issue Jun 19, 2023 · 0 comments
Assignees
Labels
task:new feature Requesting new capability or software feature theme:xunit

Comments

@delatrie
Copy link
Contributor

delatrie commented Jun 19, 2023

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:

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<CollectionFixture>{}

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

    [Fact]
    public void TestMehtod(){}
}

should produce the following report:

image

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.

@delatrie delatrie added theme:xunit task:new feature Requesting new capability or software feature labels Jun 19, 2023
@delatrie delatrie self-assigned this Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task:new feature Requesting new capability or software feature theme:xunit
Projects
None yet
Development

No branches or pull requests

1 participant