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

Missing possibility to retrieve a test's resulting ParallelScope #4707

Open
maettu-this opened this issue May 8, 2024 · 1 comment
Open

Comments

@maettu-this
Copy link

Retrieving a test's resulting ParallelScope combined from assembly, fixture and test level Parallelizable and NonParallelizable attributes missing?

I have a test which shall slightly change its behavior depending on whether it is executing in parallel with other tests. Pseudo code:

if (executing in parallel)
	use dynamic ephemeral port to run local socket test
else
	use fixed default port to run local socket test

Rationale:

  • CI/Standard use case: Running multiple socket tests in parallel requires servers to use different local ports.
  • Devel/Debug use case: Running single socket test is easier to debug when using fixed port.

As Parallelizable and NonParallelizable can be applied to assembly, fixture or test level, I have tried finding a way to retrieve the resulting ParallelScope:

  • Searched documentation and issues.
  • Tried to retrieve from TestContext as well as as internal TestExecutionContext.

See attached project which trace outputs the ParallelScope based on the test's Properties. However, only the test's attributes are replicated in the Properties, not the resulting ParallelScope combined from assembly, fixture and test level. Is this information available elsewhere?

RetrieveParallelScope.zip

grafik

@maettu-this
Copy link
Author

Also tried TestExecutionContext.CurrentContext.ParallelScope but that returns ParallelScope.Default in all cases expect TestFixtureParallelizable.TestParallelizable where ParallelScope.Children is returned.

And there is no TestExecutionContext.CurrentContext.CurrentText.ParallelScope that could hold the value for the current test.

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

No branches or pull requests

1 participant