Example #1
0
        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();
        }
Example #2
0
        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.StartDriver();
            //_driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(Convert.ToInt16(testEnvInfo.implicitTimeout)));
            string baseURL = testEnvInfo.GetURL();
        }
Example #3
0
 public static void EmergencyTeardown(TestEnvInfo t)
 {
     if (!t.EndToEnd)
     {
         TakeScreenShot(t);
         CaqLib wd = new CaqLib(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();
     }
 }
Example #4
0
 public static void TakeScreenShot(TestEnvInfo testInfo)
 {
     if (AutomationLogging.countOfError > 0)
     {
         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());
         }
     }
 }
Example #5
0
        // private static ScreenCaptureJob job;
        // XmlConfigurator.
        //private readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public CaqLib(TestEnvInfo t)
        {
            testEInfo   = t;
            testTimeout = Convert.ToInt32(t.ExplicitTimeout());
        }