Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeting Yang <ketyang@microsoft.com>2019-09-06 00:10:54 +0300
committerKeting Yang <ketyang@microsoft.com>2019-09-06 00:10:54 +0300
commit47534eaef045441c6c0e72ea914aa24812133eee (patch)
tree53960fac892401b0aaa2be54d3fad49a69220655 /main/src/addins/MonoDevelop.UnitTesting
parent019b1719a52269555060e5d8512de3d761a8388e (diff)
Support Debug All Test with multiple unit test projects under one solution folder
Diffstat (limited to 'main/src/addins/MonoDevelop.UnitTesting')
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/Commands/UnitTestCommands.cs25
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/Gui/TestPad.cs36
2 files changed, 36 insertions, 25 deletions
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Commands/UnitTestCommands.cs b/main/src/addins/MonoDevelop.UnitTesting/Commands/UnitTestCommands.cs
index 0fcda3f9ba..ed0a1e6846 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/Commands/UnitTestCommands.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/Commands/UnitTestCommands.cs
@@ -95,24 +95,27 @@ namespace MonoDevelop.UnitTesting.Commands
class DebugAllTestsHandler : CommandHandler
{
- protected override void Run ()
+ protected async override void Run ()
{
- WorkspaceObject ob = IdeApp.ProjectOperations.CurrentSelectedObject;
+ SolutionFolder ob = IdeApp.ProjectOperations.CurrentSelectedSolution.RootFolder;
if (ob != null) {
- UnitTest test = UnitTestService.FindRootTest (ob);
- if (test != null) {
- var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();
- if (debugModeSet == null)
- return;
+ var testGroup = UnitTestService.FindRootTest (ob) as UnitTestGroup;
+ var tests = testGroup.Tests;
+ if (tests == null)
+ return;
+
+ var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();
+ if (debugModeSet == null)
+ return;
+
+ foreach (UnitTest test in tests) {
foreach (var mode in debugModeSet.ExecutionModes) {
if (test.CanRun (mode.ExecutionHandler)) {
- ExecutionContext context = new ExecutionContext (mode, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);
- UnitTestService.RunTest (test, context);
- return;
+ ExecutionContext context = new ExecutionContext (mode.ExecutionHandler, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);
+ await UnitTestService.RunTests (new UnitTest [] { test }, context, true).Task;
}
}
}
-
}
}
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Gui/TestPad.cs b/main/src/addins/MonoDevelop.UnitTesting/Gui/TestPad.cs
index 081742ca3d..b3d54e61b1 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/Gui/TestPad.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/Gui/TestPad.cs
@@ -490,7 +490,7 @@ namespace MonoDevelop.UnitTesting
}
void StopRunningTests ()
- {
+ {
if (runningTestOperation != null)
runningTestOperation.Cancel ();
}
@@ -559,28 +559,36 @@ namespace MonoDevelop.UnitTesting
{
RunTest (TreeView.GetRootNode (), null);
}
-
- void OnDebugAllClicked (object sender, EventArgs args)
+
+ async void OnDebugAllClicked (object sender, EventArgs args)
{
var nav = TreeView.GetRootNode ();
if (nav == null)
return;
- var test = nav.DataItem as UnitTest;
- if (test == null)
+ var testGroup = nav.DataItem as UnitTestGroup;
+ var tests = testGroup.Tests;
+ if (tests == null)
return;
var debugModeSet = Runtime.ProcessService.GetDebugExecutionMode ();
if (debugModeSet == null)
return;
- foreach (var mode in debugModeSet.ExecutionModes) {
- if (test.CanRun (mode.ExecutionHandler)) {
- RunTest (test, mode.ExecutionHandler);
- return;
+ this.buttonRunAll.Sensitive = false;
+ this.buttonDebugAll.Sensitive = false;
+ this.buttonStop.Sensitive = true;
+
+ foreach (UnitTest test in tests) {
+ foreach (var mode in debugModeSet.ExecutionModes) {
+ if (test.CanRun (mode.ExecutionHandler)) {
+ ExecutionContext context = new ExecutionContext (mode.ExecutionHandler, IdeApp.Workbench.ProgressMonitors.ConsoleFactory, null);
+ await UnitTestService.RunTests (new UnitTest [] { test }, context, true).Task;
+ }
}
}
+ OnTestSessionCompleted ();
}
void RunSelectedTest (IExecutionHandler mode)
@@ -994,19 +1002,19 @@ namespace MonoDevelop.UnitTesting
protected override bool OnExposeEvent (Gdk.EventExpose args)
{
- using (Gdk.GC gc = new Gdk.GC (GdkWindow)) {
- gc.ClipRectangle = Allocation;
+ using (Gdk.GC gc = new Gdk.GC (GdkWindow)) {
+ gc.ClipRectangle = Allocation;
GdkWindow.DrawLayout (gc, padding, padding, layout);
}
return true;
}
- protected override void OnDestroyed ()
+ protected override void OnDestroyed ()
{
if (layout != null) {
layout.Dispose ();
layout = null;
- }
- base.OnDestroyed ();
+ }
+ base.OnDestroyed ();
}
}
}