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

Pick up xunit fixtures automatically #359

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

Pick up xunit fixtures automatically #359

delatrie opened this issue Jun 19, 2023 · 0 comments
Assignees
Labels
task:improvement Change that improves some user experience but can't be considered a new feature theme:xunit

Comments

@delatrie
Copy link
Contributor

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:

using Xunit;

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

    [Fact]
    public void TestMethod(){}

    public void Dispose() {}
}

should produce the same report as this:

using Allure.XUnit.Attributes.Steps;
using Xunit;

public class TestClass : IDisposable
{
    [AllureBefore]
    public TestClass() {}

    [Fact]
    public void TestMethod(){}

    [AllureAfter]
    public void Dispose() {}
}

image

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).

@delatrie delatrie added theme:xunit task:improvement Change that improves some user experience but can't be considered a new feature labels Jun 19, 2023
@delatrie delatrie self-assigned this Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task:improvement Change that improves some user experience but can't be considered a new feature theme:xunit
Projects
None yet
Development

No branches or pull requests

1 participant