Thursday, 12 March 2020

TestNG: Exploring Assertions

Assertions are used to check whether given test is passed or failed.

For example 'assertEquals' method check whether given result is matches with expected value or not.
@Test
public void add_10And20_30() {
 Calculator calculator = new Calculator();

 int result = calculator.add(10, 20);

 assertEquals(result, 30);
}

In upcoming posts, you are going to learn core assertions that you will use while working with testing library.


Previous                                                    Next                                                    Home

No comments:

Post a Comment