diff options
author | Manish Sinha <manish.sinha@xamarin.com> | 2015-10-22 01:25:08 +0300 |
---|---|---|
committer | Manish Sinha <manish.sinha@xamarin.com> | 2015-10-22 05:15:16 +0300 |
commit | a9b040608588940c81b282051bf02d325fd9b935 (patch) | |
tree | a62c2ba2ce8926f7e84a830a02d3a75e42c3b852 /main/tests | |
parent | 587cfa1d04432f67d54873be38ab24d103c65377 (diff) |
Test] Fix the order in which TearDown operations are called
Diffstat (limited to 'main/tests')
-rw-r--r-- | main/tests/UserInterfaceTests/UITestBase.cs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/main/tests/UserInterfaceTests/UITestBase.cs b/main/tests/UserInterfaceTests/UITestBase.cs index 924dcbfa09..f803626d8c 100644 --- a/main/tests/UserInterfaceTests/UITestBase.cs +++ b/main/tests/UserInterfaceTests/UITestBase.cs @@ -93,36 +93,39 @@ namespace UserInterfaceTests public virtual void Teardown () { try { - if (TestContext.CurrentContext.Result.Status != TestStatus.Passed) { - var updateOpened = Session.Query (IdeQuery.XamarinUpdate); - if (updateOpened != null && updateOpened.Any ()) - Assert.Inconclusive ("Xamarin Update is blocking the application focus"); - } - ValidateIdeLogMessages (); - - LoggingService.RemoveLogger (Logger.Name); - Logger.Dispose (); - } finally { + bool isInconclusive = false; var testStatus = TestContext.CurrentContext.Result.Status; if (testStatus != TestStatus.Passed) { try { + var updateOpened = Session.Query (IdeQuery.XamarinUpdate); + if (updateOpened != null && updateOpened.Any ()) + isInconclusive = true; TakeScreenShot (string.Format ("{0}-Test-Failed", TestContext.CurrentContext.Test.Name)); } catch (Exception e) { Session.DebugObject.Debug ("Final Screenshot failed"); + Session.DebugObject.Debug (e.ToString ()); } } File.WriteAllText (Path.Combine (currentTestResultFolder, "MemoryUsage.json"), - JsonConvert.SerializeObject (Session.MemoryStats, Formatting.Indented)); + JsonConvert.SerializeObject (Session.MemoryStats, Formatting.Indented)); Ide.CloseAll (); TestService.EndSession (); + ValidateIdeLogMessages (); + OnCleanUp (); if (testStatus == TestStatus.Passed) { if (Directory.Exists (currentTestResultScreenshotFolder)) Directory.Delete (currentTestResultScreenshotFolder, true); } + + if (isInconclusive) + Assert.Inconclusive ("Xamarin Update is blocking the application focus"); + } finally { + LoggingService.RemoveLogger (Logger.Name); + Logger.Dispose (); } } |