https://github.com/astef/isolatedtestfixtureattribute
Proof of concept NUnit attribute to isolate tests on AssemblyLoadContext level
https://github.com/astef/isolatedtestfixtureattribute
assemblyloadcontext netcore3 nunit unittesting
Last synced: 29 days ago
JSON representation
Proof of concept NUnit attribute to isolate tests on AssemblyLoadContext level
- Host: GitHub
- URL: https://github.com/astef/isolatedtestfixtureattribute
- Owner: astef
- License: mit
- Created: 2019-12-15T13:41:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-15T15:14:19.000Z (over 6 years ago)
- Last Synced: 2025-12-26T01:27:55.494Z (5 months ago)
- Topics: assemblyloadcontext, netcore3, nunit, unittesting
- Language: C#
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IsolatedTestFixtureAttribute
The goal of this work is to use existing `NUnit` extensibility mechanisms to achieve `AssemblyLoadContext`-level isolation between unit-test runs.
Typical use case is testing a code which mutates static state, or have complex logic in type initializers.
[`AssemblyLoadContext`](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.loader.assemblyloadcontext) is a new scoping concept in `.NET Core`, which is intended to replace [`AppDomain`](https://docs.microsoft.com/en-us/dotnet/api/system.appdomain)s in many cases.
# Current issues
* Test method isolation is not achieved (only test classes can be isolated). `IsolatedTests3.TestSharedVariableIncrement` tests are failing, because they're using the same `AssemblyLoadContext`.
* `AssemblyLoadContext` unloadability. Currently, all created contexts are not unloaded. [DotNet Core Unloadability Design Docs](https://github.com/dotnet/coreclr/blob/master/Documentation/design-docs/unloadability.md).
* The design is poor. Better design can be supported by NUnit maintainers, see [the issue](https://github.com/nunit/nunit/issues/3444).