public void TeardownTest(TestEnvInfo testEnvInfo) { StringBuilder verificationErrors = new StringBuilder(); verificationErrors.AppendLine(System.Environment.NewLine); StopRecordingVideo(); loggerInfo.Instance.Message("TearDown the Test"); try { _driver = testEnvInfo.driver; if (AutomationLogging.countOfError > 0) { verificationErrors.AppendLine("******************Result:Fail with {" + AutomationLogging.countOfError + "} Error(s)******************"); loggerInfo.Instance.LogInfo(verificationErrors.ToString()); } else { verificationErrors.AppendLine("******************Result:Pass with No Error******************"); loggerInfo.Instance.LogInfo(verificationErrors.ToString()); } //TakeScreenShot(testEnvInfo); AutomationLogging.countOfError = 0; _driver.Quit(); _driver.Dispose(); } catch (Exception) { //loggerInfo.Instance.Message("Unable to TearDown the Test"); } //SendEmailUsingGmail(); }
public void SetupTest(TestEnvInfo testEnvInfo) { StringBuilder verificationErrors = new StringBuilder(); verificationErrors.AppendLine(System.Environment.NewLine); verificationErrors.AppendLine("##################### Test Header ####################"); verificationErrors.AppendLine(" baseURL: " + testEInfo.testClassName); verificationErrors.AppendLine(" baseURL: " + testEnvInfo.baseURL); verificationErrors.AppendLine(" GUID: " + testEnvInfo.guid); verificationErrors.AppendLine(" CurrentBrowser: " + testEnvInfo.parentBrowser); verificationErrors.AppendLine(" TestUser: "******" TestPassword: "******" TestEmail: " + testEnvInfo.email); verificationErrors.AppendLine(" Timeout: " + testEnvInfo.implicitTimeout + " sec"); verificationErrors.AppendLine(" StartTime: " + DateTime.Now.ToString()); verificationErrors.AppendLine("#######################################################"); //loggerInfo loggerInfo = new WDGL.loggerInfo(); loggerInfo.Instance.LogInfo(verificationErrors.ToString()); loggerInfo.Instance.LogInfo("Start SetupTest"); StartRecordingVideo(); _driver = testEnvInfo.StratDriver(); _driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Convert.ToInt16(testEnvInfo.implicitTimeout))); string baseURL = testEnvInfo.GetURL(); }
public static void EmergencyTeardown(TestEnvInfo t) { wdgl wd = new wdgl(t); loggerInfo.Instance.LogWarning("killing the process in middle of the test"); IWebElement currEl = _driver.SwitchTo().ActiveElement(); wd.TeardownTest(t); Process p = Process.GetCurrentProcess(); p.Kill(); }
public static void TakeScreenShot(TestEnvInfo testInfo) { Screenshot ss = ((ITakesScreenshot)_driver).GetScreenshot(); string screenshot = ss.AsBase64EncodedString; byte[] screenshotAsByteArray = ss.AsByteArray; ss.SaveAsFile(AutomationLogging.newLocationInResultFolder + "\\" + testInfo.testClassName + "_" + AutomationLogging.countOfError.ToString() + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); string pageSource = _driver.PageSource; using (StreamWriter outfile = new StreamWriter(AutomationLogging.newLocationInResultFolder + "\\" + testInfo.testClassName + "_" + AutomationLogging.countOfError.ToString() + ".html")) { outfile.Write(pageSource.ToString()); } }
public void TeardownTest(TestEnvInfo testEnvInfo) { loggerInfo.Instance.Message("TearDown the Test"); try { _driver = testEnvInfo.driver; TakeScreenShot(testEnvInfo); _driver.Quit(); _driver.Dispose(); } catch (Exception) { //loggerInfo.Instance.Message("Unable to TearDown the Test"); } }
public void SetupTest(TestEnvInfo testEnvInfo) { _driver = testEnvInfo.StratDriver(); _driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Convert.ToInt16(testEnvInfo.timeout))); string baseURL = testEnvInfo.GetURL(); StringBuilder verificationErrors = new StringBuilder(); AutomationLogging.className = testEnvInfo.testClassName; AutomationLogging.currentGuid = testEnvInfo.guid; verificationErrors.AppendLine(System.Environment.NewLine + "::::: GUID: " + testEnvInfo.guid); verificationErrors.AppendLine("::::: Timeout: " + testEnvInfo.timeout + " sec"); verificationErrors.AppendLine("::::: ParentBrowser: " + testEnvInfo.parentBrowser); verificationErrors.AppendLine("::::: TestUser: "******"::::: TestPassword: "******"::::: TestEmail: " + testEnvInfo.testEmail); verificationErrors.AppendLine("::::: baseURL: " + testEnvInfo.baseURL); verificationErrors.AppendLine("::::: DeleteOldLogfiles: " + testEnvInfo.deleteOldLogFiles); loggerInfo.Instance.LogInfo(verificationErrors.ToString()); }
public wdgl(TestEnvInfo t) { teInfo = t; testTimeout = Convert.ToInt32(t.timeout); }
public wdgl(TestEnvInfo t) { testEInfo = t; testTimeout = Convert.ToInt32(t.ExplicitTimeout()); }