User needs to define a method returning Object[][] in his test class
If a test class has many test methods, then there are two ways a user can supply test data for each test method:
1) User has to define the logic of supplying test data to different test methods (@DataProvider takes the method as input which the user has to use to supply different test data to the test methods).
2) User defines new methods annotated with @DataProvider annotation for each test method
If the data needs to be loaded from a file, the end user has to know the logic of loading the file, reading the data from the file and converting the data to the test. This creates an overhead everytime you need to write data driven tests. This also means that the end user has to test the logic of loading the data that is written as part of tests
It is difficult to pass a user defined object as test input parameter using @DataProvider annotation. Also passing standard Java Objects like StringBuffer object for example as input parameter means that the user first has to instantiate the StringBuffer class with the test data and then only can he use it. The TestNG framework does not provide any conversion support.
DataProvider has support for Parallel execution
A lot of extra work needs to be done if the data has to be read from an Excel file/CSV file/XML file etc as TestNG does not provide any support for reading a test data file
TestNG does not do anything with the data that is returned by the test method.
EasyTest
@DataLoader annotation
No extra method needed. User puts the @DataLoader annotation at either the class level(which generally means that the test data in the test input file is for all the tests in this class). Or specify the test data at the test method level using the same @DataLoader annotation.
User puts @DataLoader annotation at the class level. He can put the annotation at the method level to override the data loaded at the class level.
No Knowledge of how the data will be loaded is required by the end user. A simple @DataLoader annotation with the filepath attribute set to the test data file is all that is required to know. This also means cleaner tests.
EasyTest has a built in support for converting test data into standard Java objects or even user defined objects. User specifies the data in simple String format. easyTest automatically detects the type of input parameter that thetest method requires, and converts the String into the appropriate Object. Further to this, EasyTest also inherently supports Java PropertyEditors. Also EasyTest supports JSON representation of Object. So a user can simply provide a JSON representation of an object that he wants as part of the input parameter to thetest method and EasyTest will automatically take that JSON representation, convert it into the right type and provide it to the test method. If the user doesn’t want to use JSON representation, then he can write his own Converters to convert the string representation of test data into a user defined object.
EasyTest’s DataLoader is run before the execution of any test method to give surety to the end user that ALL the data would be loaded before any test method gets executed.
EasyTest provides inbuilt support for reading data from files like Excel, CSV, XML or even a Java Class. The only thing user has to do is use @DataLoader annotation on the test class. Rest all will be taken care of by the EasyTest framework.
EasyTest captures the test data returned by the test method and put it in the same file from which it read the test method’s input test data. This gives users something to reflect and compare the test data in future. It also helps in situations where you would like to compare test data from two different platforms. For eg. one using JPA as the technology to fetch the data and other using Plain JDBC.
TestNG
@DataProvider Annotation
If a test class has many test methods, then there are two ways a user can supply test data for each test method:
1) User has to define the logic of supplying test data to different test methods (@DataProvider takes the method as input which the user has to use to supply different test data to the test methods).
2) User defines new methods annotated with @DataProvider annotation for each test method
EasyTest
@DataLoader annotation