Sunday 11 September 2016

Assertions in TestNG

Most Commonly used Assertions in TestNg for automation testing are :

       assertEquals(boolean actual, boolean expected)
     Asserts that two booleans are equal. If not, assertions fails.
       assertEquals(boolean actual, boolean expected, String message)
                 Asserts that two booleans are equal. If not, assertions fails, & message is displayed.
       assertEquals(String actual, String expected)
               Asserts that two Strings are equal. If not, assertions fails.
       assertEquals(String actual, String expected)
               Asserts that two Strings are equal. If not, assertions fails.
       assertEquals(String actual, String expected, String message)
               Asserts that two Strings are equal. If not, assertions fails, & message is displayed.
       assertFalse(boolean condition)
              Asserts that a condition is false. If not, assertions fails.
       assertFalse(boolean condition, String message)
              Asserts that a condition is false. If not, assertions fails, & message is displayed.

       assertNotNull(Object object)
        Asserts that an object isn't null. If not, assertion fails
       assertNull(Object object)
        Asserts that an object is null.
       assertNull(Object object, String message)
        Asserts that an object is null. . If not, assertion fails, & message is displayed.
       assertTrue(boolean condition)
        Asserts that a condition is true. If not, assertion fails.
       assertTrue(boolean condition, String message)

        Asserts that a condition is true. If not, assertion fails, & message is displayed

Next

No comments:

Post a Comment