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

Automatically report SetUps and TearDowns of NUnit's test fixtures #370

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

Comments

@delatrie
Copy link
Contributor

delatrie commented Jul 6, 2023

Currently, to make test-level fixtures appears in the report, one has to mark them with [AllureBefore] (for SetUp methods) or [AllureAfter] (for TearDown methods).

We should pick the fixtures up automatically. In other words, this:

using NUnit.Framework;

public class TestClass
{
    [SetUp]
    public void SetUp() {}

    [Test]
    public void TestMethod(){}

    [TearDown]
    public void TearDown() {}
}

should produce the same report as this:

using NUnit.Allure.Attributes;
using NUnit.Framework;

public class TestClass
{
    [SetUp]
    [AllureBefore]
    public void SetUp() {}

    [Test]
    public void TestMethod(){}

    [TearDown]
    [AllureAfter]
    public void TearDown() {}
}

Test result in the report

Motivation

  1. Improve the out-of-box experience.
  2. Put allure-nunit more in line with other allure integrations.

Considerations

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

See also

allure-framework/allure-csharp#359

@delatrie delatrie self-assigned this Jul 6, 2023
@delatrie delatrie added task:improvement Change that improves some user experience but can't be considered a new feature theme:nunit labels Jul 6, 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:nunit
Projects
None yet
Development

No branches or pull requests

1 participant