In version 1.1.0 of the Unity Test Framework (UTF) we have introduced multiple ways of extending the UTF functionality to help you customize the framework to suit your CI needs.
One of the bigger changes is the TestRunnerApi. This allows for running tests programmatically from code running in the Unity editor. You can also get the test list on beforehand and get callbacks with test results.
One extension we have added is the ability to customize the build settings when building the player for tests. It is possible to combine this with callbacks on the player to split the building of the player and running the tests. This is especially useful when you want to run tests on a device, as you can avoid blocking that device while building the player. You can then also customize the way that you report back the test results. .
I am afraid not. It is not possible for us to backport the full package to 2018.4, as it would collide with the build in version. There is currently no plans for backporting the TestRunnerApi to 2018.4 either.
If the only problem is colliding with the existing framework (and not relying on some deeper integration with the engine) I could simply change the namespace or something similar.
You could try that. Make a 2019.2 project with the test-framework version you desire and then find the source code inside the PackageCache. You can then move the source inside the Packages folder of e.g. a 2018.4 project.
In addition to the namespace collisions, you might face some issues with changes to assembly definitions between 2018.4 and 2019.2.
As i thought, the test framework probably has some deeper dependencies on class introduces in newer Unity versions (DeploymentTargetLogger?) so it will not even compile on Unity 2018.4.