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

State that the scope of a SetUpFixture is limited to an assembly #4695

Open
maettu-this opened this issue Apr 20, 2024 · 1 comment
Open
Labels

Comments

@maettu-this
Copy link

Currently, SetUpFixture states "all the test fixtures in a given namespace including nested namespaces below". However, if a root namespace spans accross multiple test assemblies this statement is wrong. Consider an assembly structure like:

Assembly MyScope.MySubscope1.Test
Assembly MyScope.MySubscope2.Test
...

Even if the SetUpFixture is placed into the MyScope root namespace, adding it only to the first assembly won't fulfill the "all the test fixtures in a given namespace" statement.

Proposing to more clearly state that a SetUpFixture is...

  1. ...limited to the assembly it is contained in
  2. ...only then "all the test fixtures in a given namespace including nested namespaces below"

Note that "Notes" currently include "A SetUpFixture outside of any namespace provides SetUp and TearDown for the entire assembly." which implies SetUpFixture is limited to an assembly, but only implicitly. One approach is to rearrange the notes like:

  • A SetUpFixture is limited to an assembly.
  • A SetUpFixture in a namespace will apply to all tests in that namespace and all contained namespaces of the assembly.
  • A SetUpFixture outside of any namespace provides SetUp and TearDown for the entire assembly.

Another approach is to already state this in the very first sentence.
Or a combination of both.

Related to #4686 which requires to place a SetUpFixture into each required assembly. Somewhat related to #4106.

@OsirisTerje
Copy link
Member

I thought we already had that pretty well documented here: https://docs.nunit.org/articles/nunit/writing-tests/attributes/setupfixture.html#notes

But if you believe it will be more clear with your suggestions, feel free to raise a PR for this in the docs repo :-)
Improvements are always welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants