Hello @Monika, a Hard Assertion contains following methods:
-
AssertEquals: It is used to compare the actual and expected results. If both the actual and expected results are same, then the assertion pass with no exception and the test case is marked as "passed". If both the actual and expected results are not the same, then the assertion fails with an exception and the test case is marked as "failed". Syntax of an AssertEquals() method is given below:
-
AssertNotEquals: It is opposite to the function of AssertEquals() method. AssertNotEquals() is a method used to compare the actual and expected results. If both the actual and expected results are not the same, then the assertion pass with no exception and the test case is marked as "passed". If both the actual and expected results are same, then the assertion fails with an exception and the test case is marked as "failed". Syntax of an AssertNotEquals() method is given below:
-
AssertTrue: Assertion verifies the boolean value returned by a condition. If the boolean value is true, then assertion passes the test case, and if the boolean value is false, then assertion aborts the test case by an exception. Syntax of AssertTrue() method is given below:
-
AssertFalse: This verifies the boolean value returned by a condition. If the boolean value is false, then assertion passes the test case, and if the boolean value is true, then assertion aborts the test case by an exception. Syntax of AssertFalse() method is given below:
-
AssertNull: It is a method that verifies whether the object is null or not. If an object is null, then assertion passes the test case, and the test case is marked as "passed", and if an object is not null, then assertion aborts the test case and the test case is marked as "failed". Syntax of AssertNull() method is given below:
-
AssertNotNull: AssertNotNull() is a method that verifies whether the object is null or not. If an object is not null, then assertion passes the test case and test case is marked as "passed", and if an object is null, then assertion aborts the test case and test case is marked as "failed". Syntax of AssertNotNull() method is given below: