I am not able to understand how to write Java code to implement Verify
. I am always seeing the code to implement Assert
but not for Verify
. I know for Assert
, we need to write the code as below:
Assert.assertTrue()
or
Assert.assertEquals() etc.
But what about Verify
? I want to verify the title of my application once the user is logged into the application by using verify
. How can I do this?
You must use the TestNG framework which only supports Assert statements. It doesn't support Verify statements. You can visit the following URL for TestNG Javadoc:
When Assertion fails all test steps after that line of code are skipped When a “verify” fails, the test will continue executing and logging the failure.
If you want to use Verify statements then you will have to use the Junit framework.