This blog is for Automation Test Engineers

Thursday 15 March 2018

Assertions in TesNG

Assertions plays very important role. It helps to verify the condition of your test. It the condition is not satisfied it fails the test and it will stop the execution.


Different TestNG Asserts Statements:


1)assertEquals(boolean actual,boolean expected) : Takes two boolean arguments and checks whether both are equal else it fails the test.

2)assertEquals(boolean actual,boolean expected, java.lang.String message): Takes two boolean arguments and checks whether both are equal else it fails the test with given string message.

3)assertEquals(java.lang.String actual,java.lang.String expected, java.lang.String message):  Takes two String arguments and checks whether both are equal else it fails the test with given string message.

4)assertTrue(boolean condition, java.lang.String message): verifies that condtion is true else fails the test with the given message

5)asserFalse(boolean condition, java.lang.String message):verifies that condtion is false else fails the test with the given message

6)fail(java.lang.String message): Directly it fails the test with the given message



0

0 comments:

Post a Comment