nunit: Cannot set or clear current TestExecutionContext from external runner code anymore

The TestExecutionContext.ClearCurrentContext() method has been removed in 3.7.x, and the TestExecutionContext.CurrentContext property cannot be set from external code (marked internal set in .NET Standard builds).

I have a very basic test runner that allows me to run my tests from an assembly’s void Main(..). It creates a fake TestExecutionContext for each test method that is being executed. I was using EstablishExecutionEnvironment() and ClearCurrentContext() in previous versions to install/remove this context.

Am I missing something, or is there another way to achieve the same result?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 34 (23 by maintainers)

Most upvoted comments

For me too, here in Paris. Good night guys.

Sure, but unfortunately it will have to wait until tomorrow, it’s almost midnight for me 😃. Will keep you updated with the results.

I’m a big fan of BenchmarkDotNet 😃 The test methods I want to run are more complex integration tests that run only once. I have another set of assemblies dedicated for BenchmarkDotNet, which do not require NUnit at all.