コード例 #1
0
 public static void IsTrue(IWebDriver driver, ExtentTest extentTest, bool assertedValue, string reportingMessage)
 {
     try
     {
         Assert.IsTrue(assertedValue);
         extentTest.Pass(reportingMessage);
         LoggingManager.LogInfo(reportingMessage);
     }
     catch (AssertionException)
     {
         string errorMessage = "Failure occurred when executing check '" + reportingMessage + "'";
         extentTest.Fail(errorMessage, MediaEntityBuilder.CreateScreenCaptureFromPath(ScreenShotsManager.CreateScreenshot(driver)).Build());
         LoggingManager.LogError(errorMessage);
         throw;
     }
 }
コード例 #2
0
        public static void AreEqual(IWebDriver driver, ExtentTest extentTest, double expectedValue, double actualValue, string reportingMessage)
        {
            try
            {
                Assert.AreEqual(expectedValue, actualValue);
                extentTest.Pass(reportingMessage);
                LoggingManager.LogInfo(reportingMessage);
            }
            catch (AssertionException)
            {
                string errorMessage = "Failure occurred when executing check '" + reportingMessage + "', actual value was " + actualValue;

                if (driver != null)
                {
                    extentTest.Fail(errorMessage, MediaEntityBuilder.CreateScreenCaptureFromPath(ScreenShotsManager.CreateScreenshot(driver)).Build());
                    LoggingManager.LogError(errorMessage);
                }
                else
                {
                    extentTest.Fail("Failure occurred when executing check '" + reportingMessage + "', actual value was " + actualValue);
                    LoggingManager.LogError(errorMessage);
                }
                throw;
            }
        }