Showing posts with label WebDriver Assertions. Show all posts
Showing posts with label WebDriver Assertions. Show all posts

As you know, there are many assertions in TestNG and you will find most of them on THIS PAGE. Each of these TestNG assertions are designed to fulfill different kind of conditions. I have described mostly used all assertions with very clear examples with selenium webdriver test. If you will see on that link, you will find example of assertNull assertion. assertNotNull assertion works opposite to assertNull assertion means it will assert not null condition.

Assertions are very useful to check your expected result and skip execution if assertion fails on run time. If you are selenium IDE user, you can read all these selenium IDE ASSERTION COMMANDS examples posts to use them in your test cases for your web application. Before describing about assertNull assertion of testngI recommend you all to READ OTHER WEBDRIVER ASSERTION METHOD examples for your reference.

When you are working with selenium webdriver, you must be aware about different kind of assertions which are available. If you have a enough knowledge about testng assertions, You can create very effective test cases for your test scenarios. assertEquals, assertNotEquals and assertTrue assertions are already explained in my previous posts. Now let we try to understand usage of testng assertfalse in selenium webdriver.

Previously we have learnt two assertions of selenium webdriver software testing tool. You can view practical example pages of selenium webdriver assertionsassertEquals and assertNotEquals before learning asserttrue in selenium. There is also one another related assertion is assertFalse(condition) assertion but we will look about it in my next post.

As described in my previous post, assertEquals assertion is useful to compare two string, boolean, byte[], char, double, float, int, etc.. and based on assertion result,  Your test method will pass or fail. This pass or fail indication will helps you in your testing process. So this is the very good function in selenium WebDriver which helps us to find and log issue. Please note one thing once more is - Use hard assertions in selenium webdriver only when you wants to skip remaining test execution on assertion fail. If you wants to continue execution on assertion failure, you can use TestNg soft assertions. We will discuss about it in my upcoming post.

There are many assertions available in Selenium WebDriver software testing tool with TestNG framework and we will look at all of then one by one. Assertions are important and very useful in any software automation tools to assert something during your test execution. If you know, Selenium IDE software testing tool has many built in assertion commands and if you are selenium IDE user then you can view set of selenium IDE assertion command examples on THIS LINK.