Data providers can run in parallel with the attributeparallel: The Data Provider method can return one of the following types: The first dimensions size is the number of times the test method will be invoked and the second dimension size contains an array of objects that must be compatible with the parameter types of the test method. Got Questions? Run Selenium Tests on Real Devices for Free. document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() ) This blog provides tutorials and how-to guides on Java and related technologies. 1.The test class contains a setData() method which takes two arguments name and rollNo as input and prints it on the console when it will be executed. "publisher": Let us create separate classes for the DataProvider method and the test method, as shown below: We can see that all we did was mark the DataProvider method as static and create a new class. It is a strategy of execution which automatically runs test cases multiple times using different values. This TestNG parameter is especially useful when you want to integrate your external data files like an Excel file into the same code. TestNG Framework Tutorial | Download, Installation, 2. To do so, we need to follow some simple steps in order to achieve our target of using Excel as a DataProvider.
After doing so we can simply pass the Data Provider in TestNG to our test method and our final code would look like below: Now on running this code you will see results like below.
DataProvider feature is one of the important features provided by TestNG.