public virtual void Setup() { try { ie = IEFactory.GetInternetExplorer(); // new SmartIE(true); } catch (Exception e) { Console.WriteLine(e); ExecutionSteps.Log.WriteException(e); if (ie != null) { IEFactory.Release(ie); } throw; } Thread.SetData(DATA_SLOT, this); LoadSite(); if (AutoLogin) { LogoutIfLoggedIn(); LoginAs(UserName, Password); } }
public virtual void TearDown() { try { bool testError = TestContext.CurrentContext.Outcome.Status == TestStatus.Failed; bool serverError = ie.ContainsText("Server Error"); if (testError || serverError) { Snapshot("Test Failed on this page", ExecutionSteps.Log); Assert.IsFalse(serverError, "An error left the system in a failing state.\n" + ErrorContext()); } LogoutIfLoggedIn(); ie.GoTo("about:blank"); } finally { IEFactory.Release(ie); ie = null; Thread.SetData(DATA_SLOT, null); } }