From 4d14d71d4d5a163cb7e07b2d6219a844212bb552 Mon Sep 17 00:00:00 2001 From: Charlie Poole Date: Tue, 23 Mar 2021 17:28:59 -0700 Subject: [PATCH] Fix for issue 609 --- .../Runners/DirectTestRunner.cs | 2 ++ .../Runners/MasterTestRunnerTests.cs | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/NUnitEngine/nunit.engine.core/Runners/DirectTestRunner.cs b/src/NUnitEngine/nunit.engine.core/Runners/DirectTestRunner.cs index 81228fc81..83b90f3ac 100644 --- a/src/NUnitEngine/nunit.engine.core/Runners/DirectTestRunner.cs +++ b/src/NUnitEngine/nunit.engine.core/Runners/DirectTestRunner.cs @@ -103,6 +103,8 @@ protected override TestEngineResult LoadPackage() var driverService = Services.GetService(); + _drivers.Clear(); + foreach (var subPackage in packagesToLoad) { var testFile = subPackage.FullName; diff --git a/src/NUnitEngine/nunit.engine.tests/Runners/MasterTestRunnerTests.cs b/src/NUnitEngine/nunit.engine.tests/Runners/MasterTestRunnerTests.cs index 099305369..59f9f8cdf 100644 --- a/src/NUnitEngine/nunit.engine.tests/Runners/MasterTestRunnerTests.cs +++ b/src/NUnitEngine/nunit.engine.tests/Runners/MasterTestRunnerTests.cs @@ -171,6 +171,36 @@ public void Run() CheckTestRunEvents(); } + [Test] + public void RunAfterReload() + { + // Engine issue #609 + _runner.Load(); + _runner.Reload(); + var result = _runner.Run(this, TestFilter.Empty); + + Assert.That(result.Name, Is.EqualTo("test-run")); + CheckTestRunResult(result, _testRunData); + + CheckThatIdsAreUnique(result); + + CheckTestRunEvents(); + } + + [Test] + public void ExploreAfterReload() + { + // Engine issue #609 + _runner.Load(); + _runner.Reload(); + var result = _runner.Explore(TestFilter.Empty); + + Assert.That(result.Name, Is.EqualTo("test-run")); + CheckResult(result, _testRunData); + + CheckThatIdsAreUnique(result); + } + [Test] public void RunAsync() {