From 4b06e6a7b66e3b92fc62b7cc1ec57f0590261aea Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sun, 22 Aug 2010 10:52:01 +0000 Subject: [PATCH] Code coverage results no longer being cleared after each test run when testing all projects in a solution. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6436 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Analysis/UnitTesting/Src/AbstractRunTestCommand.cs | 2 +- .../Test/Tree/RunTwoProjectsTestsTestFixture.cs | 7 +++++++ .../UnitTesting/Test/Utils/DerivedRunTestCommand.cs | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Analysis/UnitTesting/Src/AbstractRunTestCommand.cs b/src/AddIns/Analysis/UnitTesting/Src/AbstractRunTestCommand.cs index 9be0a7c72a..23fbbfd2db 100644 --- a/src/AddIns/Analysis/UnitTesting/Src/AbstractRunTestCommand.cs +++ b/src/AddIns/Analysis/UnitTesting/Src/AbstractRunTestCommand.cs @@ -303,13 +303,13 @@ namespace ICSharpCode.UnitTesting void RunTests(SelectedTests selectedTests) { if (testProgressMonitor == null) { + OnBeforeRunTests(); testProgressMonitor = context.StatusBarService.CreateProgressMonitor(); totalProjectCount = selectedTests.Projects.Count; } testProgressMonitor.TaskName = GetProgressMonitorLabel(selectedTests.Project); testProgressMonitor.Progress = GetProgress(selectedTests.Projects); - OnBeforeRunTests(); testRunner = CreateTestRunner(selectedTests.Project); if (testRunner != null) { StartTestRunner(); diff --git a/src/AddIns/Analysis/UnitTesting/Test/Tree/RunTwoProjectsTestsTestFixture.cs b/src/AddIns/Analysis/UnitTesting/Test/Tree/RunTwoProjectsTestsTestFixture.cs index 014d664dd7..4e7f852848 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/Tree/RunTwoProjectsTestsTestFixture.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/Tree/RunTwoProjectsTestsTestFixture.cs @@ -68,5 +68,12 @@ namespace UnitTesting.Tests.Tree runTestCommand.CallTestsCompleted(); Assert.IsFalse(AbstractRunTestCommand.IsRunningTest); } + + [Test] + public void OnBeforeTestRunIsCalledOnlyOnce() + { + int count = runTestCommand.OnBeforeRunTestsMethodCallCount; + Assert.AreEqual(1, count); + } } } diff --git a/src/AddIns/Analysis/UnitTesting/Test/Utils/DerivedRunTestCommand.cs b/src/AddIns/Analysis/UnitTesting/Test/Utils/DerivedRunTestCommand.cs index 00a0e68b92..bae4e560e7 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/Utils/DerivedRunTestCommand.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/Utils/DerivedRunTestCommand.cs @@ -21,6 +21,7 @@ namespace UnitTesting.Tests.Utils public bool IsRunningTestWhenOnBeforeBuildCalled; public bool IsOnStopMethodCalled; public List TestRunnersCreated = new List(); + public int OnBeforeRunTestsMethodCallCount; public DerivedRunTestCommand(IRunTestCommandContext context) : base(context) @@ -74,5 +75,10 @@ namespace UnitTesting.Tests.Utils { return CreateTestRunner(project); } + + protected override void OnBeforeRunTests() + { + OnBeforeRunTestsMethodCallCount++; + } } }