Enabling and Disabling TestNG Test
In some scenarios you may need NOT to Execute/Run some of the tests or set of tests from getting executed in a particular class. For example, consider a scenario where a serious bug exists in application due to certain tests belonging to certain scenarios that cannot be executed. As the issue has already been identified […]
TestNG Test Annotation
The most important annotation of TestNG is Test annotation. This annotation marks a method or class as TestNG test. It you apply at class level then it will mark all the public methods present inside the class as test methods. It had lot of attributes which you can use along with the Test annotation, which […]
TestNG Exception Test
While writing automation tests there can be certain scenarios where we need to verify that an exception is being thrown by the program during execution. TestNG provides a feature to test such scenarios by allowing the user to specify the type of exceptions that are expected to be thrown by a test method during execution. […]
TestNG Time-Out Test
While running tests there is a chance of where certain tests get stuck or may take much more time than expected. In such a cases you may need to mark the said test case as fail and then continue. TestNG allows user to configure a time period to wait for a test to completely execute. […]
Parameterization using testng.xml file
There are two ways to pass the parameters in the TestNg. For this, need to use Parameters and DataProvider annotations of the TestNG. Parameterization using testng.xml file will allow users to pass parameters to the test methods as an arguments using xml file. Below are the two ways to pass the arguments. 1.Using testng.xml configuration […]
TestNG Optional Parameters
TestNG optional parameters option will provide optional values to a parameter, this value will be used if parameter value is not found or not provided in the xml configuration file. To achieve this we will use @Optional annotation in the test method as an argument. Below is the sample code: The above program contains a […]
TestNG DataProvider
TestNG DataProvider is one of the most important features provided by TestNG. By using this feature user can write data-driven tests, that means a test method can run multiple times with different sets of data. In Parameterization using testng.xml file blog we have seen how to parameterize tests using testng.xml file. this feature is also […]
TestNG Grouping Tests
In TestNG, we can group multiple test methods into a named group. You can execute a particular set of test methods belonging to a group or multiple groups. This feature allows the test methods to be segregated into different sections or modules. You can have a set of test that belong to sanity test whereas […]
Dependency Test in TestNG
Dependency test in TestNG will discuss about how a test can dependent on other tests or group of tests. This feature help in executing a set of tests to be executed before a test method. Method dependency only works if the depend-on-method is part of the same class or any of the inherited base class. […]
Tests Depends on Groups in TestNG
Tests Depends on Groups in TestNG will discuss about how a test can dependent on groups or multiple groups. This feature help in executing a set of groups to be executed before a test method. Group dependency only works if the depend-on-group is part of the same class or any other classes which are in […]