Category: TestNG Tutorials

TestNG Tutorials 58: DataProvider in TestNG – Running Test for Specific Set of Data Provided by DataProvider Method – Dataprovider With Indices

By default a Test method is executed for all data set returned by DataProvider. The reason behind this is that a DataProvider annotated method has an attribute called “indices” whose default value is set to “all”. You may need to run only specific set of data. Like if DataProvider providing you five set of data […]

TestNG Tutorials 57: DataProvider in TestNG – Passing External Data File Name to DataProvider Method Using TestNG xml

In last post, we have learnt how can we make parameterized DataProvider method in TestNG to provide test data to multiple Test methods from single DataProvider method. Let’s make it more customised. Suppose you need to read data from external file like Excel, properties file etc in a DataProvider method. The name of external file […]

TestNG Tutorials 56: DataProvider in TestNG – Parameterizing DataProvider Method to Provide Data to Multiple Test Methods

“DataProvider” is an important feature provided by TestNG to provide required test data to test methods to run on. We have learnt different approaches which we can utilize to get best of DataProvider in previous posts. Let’s learn another way to make more use of DataProvider in TestNG. Suppose we have three Test methods and […]

TestNG Tutorials 55: DataProvider in TestNG – Lazy Initialisation of DataProvider Method – Use of Iterator Return Type

Hello, DataProvider is an important functionality provided by TestNG to achieve Data driven testing or providing a set of different dataset to a method to execute on. We have seen DataProvider concept in details in previous posts. DataProvider may become nightmare if number of data (arguments) is more or it keeps changing or you do not […]

TestNG Tutorials 54: DataProvider in TestNG – Implementing Object Oriented Concept “Encapsulation” with DataProvider Method

Hello Folks, As part of ongoing series on DataProvider, we will learn “How does Encapsulation ( in OOPS concept) help in a DataProvider method? ” in this post. Encapsulation is an Object Oriented Programming concept which describes binding of related stuffs together under one roof. It makes easier to add , remove and modify members. For […]

TestNG Tutorials 52: DataProvider in TestNG – Accessing DataProvider Methods From Another Class Test Class

Hello Guys, Now we have good understanding of DataProviders in TestNG from previous articles. If you have not read my previous posts on DataProvider, you can go through them below: Why do you need DataProvider? How does DataProvider work? DataProvider with 2D array You can notice in all previous posts that I kept DataProvider methods […]

TestNG Tutorials 51: DataProvider in TestNG – Two Dimensional Array DataProvider Method

Hello Folks, In last post, we have seen Basics of DataProvider in TestNG and its working logic with one dimensional array. In this post I will explain the working logic of a DataProvider method which returns a two dimensional array. I see people are always confused with the usage of a DataProvider method which returns […]

TestNG Tutorials 50: DataProvider in TestNG – Understand Basics of DataProvider & How It Works

Hello Folks, In last post, we have seen Why do we need to use DataProvider in TestNG. Now we will see a serie of posts on DataProvider. What is DataProvider? DataProvider is an annotation to mark a method as data provider which provides data as an array of array of Objects which can be used […]

TestNG Tutorials 49: Need of DataProvider Method in TestNG

Hello Folks, TestNG provides a beautiful functionality to parameterized our configuration and test methods so that we can execute the same test script with different set of data. To make a method (Configuration and Test) parameterized , we use “Parameters” annotation. If we make a method parameterized, we must need to pass parameters values from […]

TestNG Tutorials 48: How to Pass Parameters of Different Datatypes in TestNG

Hello Folks, Most of us know that, we can pass parameter as a String to methods in TestNG class. Is it really like that? No. Its not. We can pass parameters in whatever data types we required. TestNG will convert them automatically to required data type. We will see an example below: Output: Note: 1. […]

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.