allure-framework / allure-framework/allure-csharp

Automatically report SetUps and TearDowns of NUnit's test fixtures

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

Description

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:

```csharp
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:

```csharp
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](https://github.com/allure-framework/allure-csharp/issues/359)

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reviewing how allure-nunit currently handles NUnit [SetUp] and [TearDown] methods, then read the related allure-csharp#359 issue; done means automatic fixture reporting preserves custom naming, exclusion, and backward compatibility for [AllureBefore] and [AllureAfter].

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.