Skip to content

v4 Console/Engine Platform support  #770

@ChrisMaddock

Description

@ChrisMaddock

NUnit has a long history of supporting legacy platforms. For v4, I wanted to think about how we can continue to do that, whilst reducing the burden on the development team. This post is intended to start that discussion.

Some high level thoughts:

  • I'd like to see all the code in the main Engine/Console project targeting modern platforms.
  • I'd like us to be able to continue to run tests on legacy platforms in an arms-length manner.
  • I'd like to do whatever possible to reduce platform lock-in, and allow us to be more flexible in our commitment to supporting platforms.

Here's how I was thinking we could address that, component-by-component:

The Console

The NUnit Console has historically been restricted to targeting .NET 2.0, as we've committed to being able to run tests on platforms with only .NET 2.0 installed.

.NET Core brought about self-contained executables, which allow us to run on any platform, with no dependency on any runtimes being installed. To me, a truly portable test runner exactly where we want to be. This would then mean that in future, we can upgrade the console's platform as we see fit, as opposed to being restricted to targeting the lowest-supported platform.

The Engine Agents

It is necessary to have an engine agent for every platform we wish to run tests on. I would like us to look at making it possible to add agents via the engine's extensibility functionality, so that users can set up the NUnit Engine can support a range of platforms, and the Engine Team aren't required to support all of these.

I'd like us to look at moving the CLR v2 agent out to an extension, and removing it from the main codebase, as we did with e.g. NUnit 2 functionality at the start of NUnit 3. .NET 2.0 is nearly 20 years old, and Microsoft's support for it ended just under 10 years ago. Doing this would mean there was a viable method for users to continue running tests on CLR v2, but it was not part of the main supported codebase.

.NET Framework and .NET Core agents should of course part of the main distribution - I hope the latter will be added during the 3.x series.

The Engine

The main engine assembly appears to be the main place where we will still be restricted on the platforms we support, as the platform the engine targets of course affects runners that rely on it.

I would like to see two ideas considered:

  1. Removing in-process test running entirely. This would provide complete separation between the target platform of the engine, and the target platform of tests we support running.

  2. Aiming for a single-build, which can be utilised by runners on all operating systems. Right now .NET Standard 2.0 may be the most suitable option, but that picture may well change over the time it takes to develop v4 and as .NET 5 is released - and I think it would be sensible to review the exact platform further down the line.

The second change would mean that we would be dropping support for test runners targeting .NET Framework 2.0-4.6.0. My view is that those wishing to build a test runner for these platforms should instead be looking at self-contained deployment, as we would be doing ourselves for the Console. I don't think we should hold back Engine development to legacy platforms, now an improved solution for building test runners that run on older platforms exists.

Engine API assembly

Funny one - I currently see the API assembly as serving two distinct purposes.

  1. The API for runners wishing to reference the engine
  2. The assembly to be referenced by engine extensions

Based on the fact that driver extensions currently need to be loaded by agents, there is a potential need for extensions to be able to target legacy platforms, and thus the API assembly as well. This is a restriction that's only necessary for "purpose 2" however - so I wonder if there's value in splitting the API assembly? This would give us e.g.:

  1. nunit.engine.api.dll: Contains all the code in the current API assembly, targets the same platform(s) as nunit.engine.dll
  2. nunit.extensions.api.dll: A new, super-slim assembly, which contains only the interfaces required by extension developers (IProjectLoader, IResultWriter etc.). This assembly could continue to target the lowest platform we see fit - potentially .NET 2.0.

Mono

Final little thorn here - as long as I've worked on NUnit, we've lacked willing contributors to invest in our Mono-specific functionality. My ideal would be for a member of the Mono community to step up and commit to providing support for mono, however no such person has materialised over the course of NUnit 3. On this basis, in order to only commit to what the team can continue to support, I'd like to review our level of Mono support, including:

  • Removal of our Mono specific functionality. I think this is currently only installed framework discovery and targeting.

  • A commitment to continue running our tests on mono, as long as our CI systems reasonably support this scenario. However, a disclaimer that we may chose to exclude new features from running on mono, if the volume of additional work to support the platform is more than a contributor is prepared to undertake.

Side note, we currently have a method to invoke running test on mono from the .NET Framework console. I have no idea if anyone uses it, or even if it works - but I wonder if that could also be moved to an extension, as per the .NET 2.0 agent above.


This ended up a little longer than I expected - I've laid out a lot of ideas, but very much invite everyone's thoughts and feedback on them. I'm intending this to start the discussion, rather than be a design document quite yet. 🙂

Metadata

Metadata

Assignees

Labels

Breaking ChangeV4All issues related to V4 or later - use -label:V4 to get V3 issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions