Assertion
PURPOSE OF ASSERT IN A TEST AUTOMATION SUITE
Assert plays vital role in automation testing. Without assertion we cannot provide the status of the test cases passed, failed etc. Assertion is used to validate the status of a test case.
Let's take an example of a login page where a user logged in through valid username , valid password and clicking the login button. With valid credential it should login to the home page successfully. Now that a user has been logged in successfully there should be some sort of commands which helps to validate the user has successfully logged in. Hence assertion comes into picture, where we can use assertion command to validate whether the user has been successfully logged in by comparing any text in the homepage with the text provided in the command.
eg. Assert.assertEquals(expected, actual)
Here if the actual and expected matches , then the test case will be marked as a passed.
Comments
Post a Comment