Skip to content

Correct documentation on ParallelScope #3128

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

Merged
merged 2 commits into from
Apr 27, 2019

Conversation

mikkelbu
Copy link
Member

Now specifies that ParallelScope.All also can be used on assembly level.

Now specifies that ParallelScope.All also can be used on assembly level.
@CharliePoole
Copy link
Member

But All makes no sense on the assembly, since it incorporates Self.

@mikkelbu
Copy link
Member Author

But isn't too strict to say that it is not valid on assemblies?

It is correct that Self part will not have any effect, but the Children part will work as intended. Perhaps we should distinguish in the comments - and the documentation - between whether using a particular ParallelScope value will break something - like using ParallelScope.Children on a non-parameterized test method or using ParallelScope.Fixtures on a test method (both will make the test method invalid) - or whether it just does not make much sense.

Also it seems like there are some people using ParallelScope.All on assembly level and not "just" ParallelScope.Children (probably because thay want "all" tests to be parallel).
nunit/nunit3-vs-adapter#443
https://github.com/techtalk/SpecFlow/issues/1052
nunit/docs#272
...

@CharliePoole
Copy link
Member

I think the docs should use consistent language. In my view, not valid would mean that it gives an error. I haven't actually compared the docs to the code to see if that is true. If a setting is merely ignored, perhaps that's what we should say instead of not valid.

@CharliePoole
Copy link
Member

I think your example of some people misinterpreting All suggests that it was a bad choice for a value.

[EditorBrowsable(EditorBrowsableState.Never)]
ContextMask = Children + Fixtures,

/// <summary>
/// The test and its descendants may be run in parallel with others at
/// the same level. Valid on classes and methods but not assemblies.
/// the same level. Valid on classes, parameterized methods, and assemblies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it's confusing to say All is actually invalid for assemblies unless we follow that up by marking the assembly invalid.
This would be a good thing to do if we want the freedom to change what it means for assemblies in the future. E.g. maybe it could be a signal to a future runner to control the assembly-level parallelization?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, that goes for Self as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikkelbu Do you mind leaving out assemblies until we figure out the answer?

@jnm2
Copy link
Contributor

jnm2 commented Feb 23, 2019

We could say it's not meaningful instead of saying it's not valid.

@jnm2
Copy link
Contributor

jnm2 commented Apr 24, 2019

@nunit/framework-team I like these clarifications. 3.12 is imminent and the PR is still waiting. Functionally speaking, Self on an assembly is meaningless, so you could say that All for an assembly isn't meaningfully different than Self.

If we say All is valid on an assembly, I think that amounts to recommending or confirming it. Should we do that, or should the XML point people to Children for assemblies instead?

@mikkelbu
Copy link
Member Author

@nunit/framework-team Sorry for having left this hanging for so long. What about we rephrased the summaries above ParallelScope.Self and ParallelScope.All in the following manner?

ParallelScope.Self

From

        /// The test may be run in parallel with others at the same level.
        /// Valid on classes and methods but not assemblies.

To

        /// The test may be run in parallel with others at the same level.
        /// Valid on classes and methods but has no effect on assemblies.

ParallelScope.All

From

        /// The test and its descendants may be run in parallel with others at	
        /// the same level. Valid on classes, parameterized methods, and assemblies.

To

        /// The test and its descendants may be run in parallel with others at	
        /// the same level. Valid on classes and parameterized methods.
        /// For assemblies it is recommended to use <see cref="ParallelScope.Children"/>
        /// instead, as <see cref="ParallelScope.Self"/> has no effect on assemblies.

CharliePoole
CharliePoole previously approved these changes Apr 25, 2019
Copy link
Member

@CharliePoole CharliePoole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jnm2
Copy link
Contributor

jnm2 commented Apr 26, 2019

@mikkelbu I like that.

@mikkelbu
Copy link
Member Author

@jnm2 @CharliePoole Great. I've pushed a commit with the proposed changes.

@jnm2 jnm2 merged commit 5f059bb into master Apr 27, 2019
@jnm2 jnm2 deleted the correct-documentation-of-ParallelScope branch April 27, 2019 18:50
@jnm2
Copy link
Contributor

jnm2 commented Apr 27, 2019

@mikkelbu Thank you!

@mikkelbu mikkelbu added this to the 3.12 milestone Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants