diff options
author | Matt Ward <matt.ward@xamarin.com> | 2016-03-15 14:58:52 +0300 |
---|---|---|
committer | Matt Ward <matt.ward@xamarin.com> | 2016-03-15 14:58:52 +0300 |
commit | fd1732021e544c9a4e9ad6befbdaca1e65c03127 (patch) | |
tree | b26e1806aac43961820b345485697af9b7683cbb /main/src/addins/MonoDevelop.UnitTesting | |
parent | 373df57f28d29bf3a53a568f0c264e7e5e87d757 (diff) |
[UnitTesting] Fix UITest failing to connect.
Fixed bug #39525 - UITests fail to run connect
https://bugzilla.xamarin.com/show_bug.cgi?id=39525
The UnitTestService fires an TestSessionStarting event just before the
test is started. The event args passed contains a TestSession. In
Xamarin Studio 5 there was a completed event on the TestSession that
could be used to indicate the test had finished. This completed event
has been replaced with a Task. At the time the TestSessionStarting
event is fired the Task is not yet started but the existing Task says
it is completed. Since the TestSession's Task is marked as completed
when the TestSessionStarting event is fired any action that uses the
Task will run straight away since the Task is already completed even
though the test has not been started yet.
To fix this the creation of the Task and the starting of it have been
separated. The TestSession's constructor creates a new unstarted Task
so it is available for any callers using the TestSessionStarting event.
After this event is fired the Task is started by the Start method,
which runs the tests.
Diffstat (limited to 'main/src/addins/MonoDevelop.UnitTesting')
-rw-r--r-- | main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs index ad08bacd2c..5816721bcf 100644 --- a/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs +++ b/main/src/addins/MonoDevelop.UnitTesting/Services/UnitTestService.cs @@ -407,11 +407,13 @@ namespace MonoDevelop.UnitTesting this.monitor = new TestMonitor (resultsPad, CancellationTokenSource); this.resultsPad = resultsPad; resultsPad.InitializeTestRun (test, cs); + Task = new Task ((Action)RunTests); } public Task Start () { - return Task = Task.Run ((Action)RunTests); + Task.Start (); + return Task; } void RunTests () |