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

Allure.NUnit preview: unexpected OneTimeSetUp in NUnit tests #374

Closed
1 of 3 tasks
delatrie opened this issue Aug 9, 2023 · 0 comments · Fixed by #380
Closed
1 of 3 tasks

Allure.NUnit preview: unexpected OneTimeSetUp in NUnit tests #374

delatrie opened this issue Aug 9, 2023 · 0 comments · Fixed by #380
Assignees

Comments

@delatrie
Copy link
Contributor

delatrie commented Aug 9, 2023

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

A preview version of allure-nunit adds a OneTimeSetUp fixture for a test that doesn't have one.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

Given the following test (note, it doesn't have a one-time setup method or a setup fixture that affects it):

using NUnit.Allure.Core;
using NUnit.Framework;

namespace MyNamespace;

[AllureNUnit]
class MyTestFixture
{
    [Test]
    public void MyTest() { }
}

When we run the test, allure-nunit produces a *-container.json file with the following content:

{
  "uuid": "tc-0-1000",
  "name": "MyNamespace.MyTestFixture",
  "children": [
    "dcb2b701-ad1b-4071-ab73-d9253f85967d-tr-0-1001"
  ],
  "befores": [
    {
      "name": "OneTimeSetUp",
      "status": "passed",
      "statusDetails": {
        "known": false,
        "muted": false,
        "flaky": false
      },
      "stage": "finished",
      "steps": [],
      "attachments": [],
      "parameters": [],
      "start": 1691559272130,
      "stop": 1691559272132
    }
  ],
  "afters": [],
  "links": [],
  "start": 1691559272124,
  "stop": 1691559272167
}

It renders the OneTimeSetUp fixture in the Set up section of the report:

What is the expected behavior?

Only fixtures defined in the code are included in the report.

Please tell us about your environment:

  • Allure version: 2.23.0
  • Test framework: [email protected]
  • Allure adaptor: allure-nunit (unpublished)

Other information

The fixture is started here regardless of whether a test contains a one-time setup or not.

@delatrie delatrie self-assigned this Aug 9, 2023
@delatrie delatrie added the bug label Aug 9, 2023
delatrie added a commit that referenced this issue Sep 15, 2023
…and #375) (#380)

* Fix inconsistent one-time fixtures behavior (fixes #374)

* Fix crash when running test from empty namespace (fixes #375)

* Fix indentation for AllureAsyncOneTimeSetUoTests.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants