diff --git a/src/NUnitEngine/nunit.engine/Runners/AbstractTestRunner.cs b/src/NUnitEngine/nunit.engine/Runners/AbstractTestRunner.cs index 61d95260d..f4fe3fbf3 100644 --- a/src/NUnitEngine/nunit.engine/Runners/AbstractTestRunner.cs +++ b/src/NUnitEngine/nunit.engine/Runners/AbstractTestRunner.cs @@ -80,14 +80,10 @@ public bool IsPackageLoaded protected abstract TestEngineResult LoadPackage(); /// - /// Reload the currently loaded test package. Overridden - /// in derived classes to take any additional action. + /// Reload the currently loaded test package. /// /// A TestEngineResult. - protected virtual TestEngineResult ReloadPackage() - { - return LoadPackage(); - } + protected abstract TestEngineResult ReloadPackage(); /// /// Unload any loaded TestPackage. Overridden in diff --git a/src/NUnitEngine/nunit.engine/Runners/AggregatingTestRunner.cs b/src/NUnitEngine/nunit.engine/Runners/AggregatingTestRunner.cs index 5540c38c5..76197b6cf 100644 --- a/src/NUnitEngine/nunit.engine/Runners/AggregatingTestRunner.cs +++ b/src/NUnitEngine/nunit.engine/Runners/AggregatingTestRunner.cs @@ -122,6 +122,20 @@ protected override TestEngineResult LoadPackage() return ResultHelper.Merge(results); } + /// + /// Reload the currently loaded test package. + /// + /// A TestEngineResult. + protected override TestEngineResult ReloadPackage() + { + var results = new List(); + + foreach (var runner in Runners) + results.Add(runner.Reload()); + + return ResultHelper.Merge(results); + } + /// /// Unload any loaded TestPackages. /// diff --git a/src/NUnitEngine/nunit.engine/Runners/DirectTestRunner.cs b/src/NUnitEngine/nunit.engine/Runners/DirectTestRunner.cs index 6dd2aaf90..f369afbb9 100644 --- a/src/NUnitEngine/nunit.engine/Runners/DirectTestRunner.cs +++ b/src/NUnitEngine/nunit.engine/Runners/DirectTestRunner.cs @@ -157,6 +157,21 @@ protected override TestEngineResult LoadPackage() return result; } + protected override TestEngineResult ReloadPackage() + { + var result = new TestEngineResult(); + var packages = TestPackage.Select(p => !p.HasSubPackages()); + + int index = 0; + foreach (IFrameworkDriver driver in _drivers) + { + var package = packages[index++]; + result.Add(driver.Load(package.FullName, package.Settings)); + } + + return result; + } + private static string LoadDriver(IFrameworkDriver driver, string testFile, TestPackage subPackage) { try diff --git a/src/NUnitEngine/nunit.engine/Runners/ProcessRunner.cs b/src/NUnitEngine/nunit.engine/Runners/ProcessRunner.cs index 6c28afcf7..f6614aa9f 100644 --- a/src/NUnitEngine/nunit.engine/Runners/ProcessRunner.cs +++ b/src/NUnitEngine/nunit.engine/Runners/ProcessRunner.cs @@ -109,6 +109,17 @@ protected override TestEngineResult LoadPackage() } } + /// + /// Reload the currently loaded test package. + /// + /// A TestEngineResult. + protected override TestEngineResult ReloadPackage() + { + log.Info("Reloading " + TestPackage.Name); + + return _remoteRunner.Reload(); + } + /// /// Unload any loaded TestPackage and clear /// the reference to the remote runner.