Home >> Taxonomy >> Term >> testNG

Parametrize to Execute TestNG.xml using Maven

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.

Assertions in TestNG

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. There is a difference between SoftAssert and Hard Assert.

Let us focus more on using Assertions (Hard assert). Also check SoftAssert example in TestNG for more details on soft asserts.

Skip Exception Test in TestNG

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)”