Say suppose we have a scenario where we need to execute only a set of TestNG.xml files from the wide range of available xml suite files. It is like we want to run only the specific tests that are in testng.xml files and some times we may again need to kick off other testng.xml files. But for sure we don't want to execute all the suites and wait for them to complete the execution.
What is Assertion????
Asserts helps us to verify the conditions of the test and decide whether test has failed or passed. A test is considered successful ONLY if it is completed without throwing any exception.
Here we are verifying if the page title is equal to 'Google' or not. If the page title is not matching with the text / title that we provided, it will fail the test case.
To explain you what is assertion, lets us look into below code sample
Using TestNG, we have multiple ways to Skip a test based on our requirement. We can Skip complete test without executing it or we can Skip a test when a specific condition is not satisfied.
In TestNG, @Test(enabled=false) annotation is used to skip a test case if it is not ready to test. We don't need to import any additional statements.
As in JUnit, TestNG will not show you the other test method as Skipped or Ignored. It will not consider that case method at all when the annotation is mentioned as “@Test(enabled=false)”