示例#1
0
        private bool RunOneTestSuite(BaseTestSuite testSuite)
        {
            bool      result        = true;
            string    testSuiteName = testSuite.SuiteName;
            Stopwatch stopWatch     = new Stopwatch();

            stopWatch.Start();

            try
            {
                logger.Info("Executing TestSuite: " + testSuite);

                result = testSuite.Execute();
                if (!result)
                {
                    logger.Error("Error in running test suite: " + testSuiteName);
                }
                else
                {
                    logger.Info("Successful in running test suite: " + testSuiteName);
                }
            }
            catch (Exception e)
            {
                result = false;
                logger.Error("Error while running test suite: " + testSuiteName + ". Exception: " + e);
            }

            MetricsHelper.PushTestSuiteMetric(Convert.ToInt64(stopWatch.Elapsed.TotalMinutes), testSuiteName, result.ToString());

            return(result);
        }
示例#2
0
		/// <summary>
		/// Page load performance test.
		/// </summary>
		/// <param name="ts">TestSuite</param>
		/// <param name="url">URL page</param>
		/// <param name="benchmark">Benchmark.</param>
		public static void PerformancePageLoadTest(BaseTestSuite ts, string url, int benchmark)
		{
			DateTime start = DateTime.Now;
			ts.Instance.NavigateToSkipReadyForStatic(url);
			ts.Instance.WaitForReadyForStatic();
			DateTime end = DateTime.Now;
			TimeSpan diff = end - start;
			int actual = (int)diff.TotalMilliseconds;
			int expected = benchmark;
			Console.WriteLine("Page loaded waiting for #readyForStatic in '{0}'ms", actual);
			Assert.Less(actual, expected, string.Format("Took longer than '{0}'ms to load, url '{1}'!", expected, url));
		}
示例#3
0
 /// <summary>
 /// Socials the links.
 /// </summary>
 /// <param name="ts">Ts.</param>
 /// <param name="instance">Instance.</param>
 public static void SocialLinks(BaseTestSuite ts)
 {            
     string url = "http://www.google.com/";
     Selenium.PageObjects.DefaultPage page = new Selenium.PageObjects.DefaultPage(url);
     string exceptions;
     const int expected = 5;
     StringBuilder failures = new StringBuilder();
     if (!page.VerifySocialShares(out exceptions, expected)) {
         failures.AppendLine(exceptions);
     }
     if (failures.ToString().Trim().Length > 0) {
         Assert.Fail(failures.ToString());
     }
 }