Browse Source

Removed Run All Tests context menu item from Unit Tests window. Code coverage window opened after all tests have been run with code coverage and there were no test failures. No longer using a static NCover runner which was raising events in two RunTestWithCodeCoverageCommand instances (toolbar, context menu) and causing one to try to read a test results file which no longer existed.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2329 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 19 years ago
parent
commit
78ff251b97
  1. BIN
      data/resources/StringResources.de.resources
  2. BIN
      data/resources/StringResources.es-mx.resources
  3. BIN
      data/resources/StringResources.es.resources
  4. BIN
      data/resources/StringResources.kr.resources
  5. BIN
      data/resources/StringResources.nl.resources
  6. BIN
      data/resources/StringResources.no.resources
  7. BIN
      data/resources/StringResources.pt.resources
  8. BIN
      data/resources/StringResources.ro.resources
  9. BIN
      data/resources/StringResources.tr.resources
  10. 6
      src/AddIns/Misc/CodeCoverage/CodeCoverage.sln
  11. 1
      src/AddIns/Misc/CodeCoverage/Project/CodeCoverage.csproj
  12. 36
      src/AddIns/Misc/CodeCoverage/Project/Src/NCoverRunnerSingleton.cs
  13. 19
      src/AddIns/Misc/CodeCoverage/Project/Src/RunTestWithCodeCoverageCommand.cs
  14. 26
      src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs
  15. 4
      src/AddIns/Misc/UnitTesting/UnitTesting.addin
  16. BIN
      src/Main/StartUp/Project/Resources/StringResources.resources

BIN
data/resources/StringResources.de.resources

Binary file not shown.

BIN
data/resources/StringResources.es-mx.resources

Binary file not shown.

BIN
data/resources/StringResources.es.resources

Binary file not shown.

BIN
data/resources/StringResources.kr.resources

Binary file not shown.

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

BIN
data/resources/StringResources.no.resources

Binary file not shown.

BIN
data/resources/StringResources.pt.resources

Binary file not shown.

BIN
data/resources/StringResources.ro.resources

Binary file not shown.

BIN
data/resources/StringResources.tr.resources

Binary file not shown.

6
src/AddIns/Misc/CodeCoverage/CodeCoverage.sln

@ -1,5 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 9.00 
# SharpDevelop 2.1.0.1856 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# SharpDevelop 2.1.0.2312
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage", "Project\CodeCoverage.csproj", "{08CE9972-283B-44F4-82FA-966F7DFA6B7A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage", "Project\CodeCoverage.csproj", "{08CE9972-283B-44F4-82FA-966F7DFA6B7A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage.Tests", "Test\CodeCoverage.Tests.csproj", "{A5C0E8F8-9D04-46ED-91D6-1DEF1575313B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCoverage.Tests", "Test\CodeCoverage.Tests.csproj", "{A5C0E8F8-9D04-46ED-91D6-1DEF1575313B}"

1
src/AddIns/Misc/CodeCoverage/Project/CodeCoverage.csproj

@ -62,7 +62,6 @@
<Compile Include="Src\CodeCoverageDisplayItem.cs" /> <Compile Include="Src\CodeCoverageDisplayItem.cs" />
<Compile Include="Src\ColorPickerComboBox.cs" /> <Compile Include="Src\ColorPickerComboBox.cs" />
<Compile Include="Src\NCoverRunner.cs" /> <Compile Include="Src\NCoverRunner.cs" />
<Compile Include="Src\NCoverRunnerSingleton.cs" />
<Compile Include="Src\NCoverExitEventArgs.cs" /> <Compile Include="Src\NCoverExitEventArgs.cs" />
<Compile Include="Src\CodeCoverageProjectOptionsPanel.cs" /> <Compile Include="Src\CodeCoverageProjectOptionsPanel.cs" />
<EmbeddedResource Include="Resources\CodeCoverageProjectOptionsPanel.xfrm" /> <EmbeddedResource Include="Resources\CodeCoverageProjectOptionsPanel.xfrm" />

36
src/AddIns/Misc/CodeCoverage/Project/Src/NCoverRunnerSingleton.cs

@ -1,36 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
namespace ICSharpCode.CodeCoverage
{
/// <summary>
/// Single NCover runner that is used by all commands.
/// </summary>
/// <remarks>
public class NCoverRunnerSingleton
{
static NCoverRunner runner;
NCoverRunnerSingleton()
{
}
/// <summary>
/// Gets the <see cref="NCoverRunner"/> instance.
/// </summary>
public static NCoverRunner Runner {
get {
if (runner == null) {
runner = new NCoverRunner();
}
return runner;
}
}
}
}

19
src/AddIns/Misc/CodeCoverage/Project/Src/RunTestWithCodeCoverageCommand.cs

@ -24,17 +24,15 @@ namespace ICSharpCode.CodeCoverage
public class RunTestWithCodeCoverageCommand : AbstractRunTestCommand public class RunTestWithCodeCoverageCommand : AbstractRunTestCommand
{ {
static MessageViewCategory category; static MessageViewCategory category;
static NCoverRunner runner; NCoverRunner runner;
string ncoverFileName; string ncoverFileName;
public RunTestWithCodeCoverageCommand() public RunTestWithCodeCoverageCommand()
{ {
if (runner == null) { runner = new NCoverRunner();
runner = NCoverRunnerSingleton.Runner;
runner.NCoverExited += new NCoverExitEventHandler(NCoverExited); runner.NCoverExited += new NCoverExitEventHandler(NCoverExited);
runner.OutputLineReceived += new LineReceivedEventHandler(OutputLineReceived); runner.OutputLineReceived += new LineReceivedEventHandler(OutputLineReceived);
} }
}
protected override void RunTests(UnitTestApplicationStartHelper helper) protected override void RunTests(UnitTestApplicationStartHelper helper)
{ {
@ -65,6 +63,17 @@ namespace ICSharpCode.CodeCoverage
} }
} }
/// <summary>
/// Shows the code coverage results window only if there were no
/// test failures.
/// </summary>
protected override void OnAfterRunTests()
{
if (!TaskService.HasCriticalErrors(false)) {
ShowPad(WorkbenchSingleton.Workbench.GetPad(typeof(CodeCoveragePad)));
}
}
/// <summary> /// <summary>
/// Gets the message view output window. /// Gets the message view output window.
/// </summary> /// </summary>
@ -126,8 +135,8 @@ namespace ICSharpCode.CodeCoverage
{ {
System.Diagnostics.Debug.Assert(e.Error.Length == 0); System.Diagnostics.Debug.Assert(e.Error.Length == 0);
WorkbenchSingleton.SafeThreadAsyncCall(TestsFinished);
DisplayCoverageResults(runner.CoverageResultsFileName); DisplayCoverageResults(runner.CoverageResultsFileName);
WorkbenchSingleton.SafeThreadAsyncCall(TestsFinished);
} }
void OutputLineReceived(object sender, LineReceivedEventArgs e) void OutputLineReceived(object sender, LineReceivedEventArgs e)

26
src/AddIns/Misc/UnitTesting/Src/RunTestCommands.cs

@ -118,6 +118,14 @@ namespace ICSharpCode.UnitTesting
{ {
} }
/// <summary>
/// Called after all tests have been run even if there have
/// been errors. If multiple projects are to be tested this is called only once.
/// </summary>
protected virtual void OnAfterRunTests()
{
}
protected abstract void RunTests(UnitTestApplicationStartHelper helper); protected abstract void RunTests(UnitTestApplicationStartHelper helper);
/// <summary> /// <summary>
@ -141,6 +149,7 @@ namespace ICSharpCode.UnitTesting
if (TaskService.SomethingWentWrong && ErrorListPad.ShowAfterBuild) { if (TaskService.SomethingWentWrong && ErrorListPad.ShowAfterBuild) {
ShowErrorList(); ShowErrorList();
} }
OnAfterRunTests();
} }
} }
@ -162,6 +171,16 @@ namespace ICSharpCode.UnitTesting
{ {
} }
/// <summary>
/// Brings the specified pad to the front.
/// </summary>
protected void ShowPad(PadDescriptor padDescriptor)
{
if (padDescriptor != null) {
WorkbenchSingleton.SafeThreadAsyncCall(padDescriptor.BringPadToFront);
}
}
/// <summary> /// <summary>
/// Runs the tests after building the project under test. /// Runs the tests after building the project under test.
/// </summary> /// </summary>
@ -269,13 +288,6 @@ namespace ICSharpCode.UnitTesting
return null; return null;
} }
void ShowPad(PadDescriptor padDescriptor)
{
if (padDescriptor != null) {
WorkbenchSingleton.SafeThreadAsyncCall(padDescriptor.BringPadToFront);
}
}
void ShowErrorList() void ShowErrorList()
{ {
ShowPad(WorkbenchSingleton.Workbench.GetPad(typeof(ErrorListPad))); ShowPad(WorkbenchSingleton.Workbench.GetPad(typeof(ErrorListPad)));

4
src/AddIns/Misc/UnitTesting/UnitTesting.addin

@ -131,10 +131,6 @@
<Condition name="RunningTests"/> <Condition name="RunningTests"/>
</Not> </Not>
</And> </And>
<MenuItem id = "RunAll"
icon = "Icons.16x16.RunAllIcon"
label = "${res:NUnitPad.NUnitPadContent.RunAllTests}"
class = "ICSharpCode.UnitTesting.RunAllTestsInPadCommand"/>
<MenuItem id = "Run" <MenuItem id = "Run"
icon = "Icons.16x16.RunProgramIcon" icon = "Icons.16x16.RunProgramIcon"
label = "${res:NUnitPad.NUnitPadContent.RunTestsContextMenuLabel}" label = "${res:NUnitPad.NUnitPadContent.RunTestsContextMenuLabel}"

BIN
src/Main/StartUp/Project/Resources/StringResources.resources

Binary file not shown.
Loading…
Cancel
Save