java - Type mismatch: cannot convert from DataProvider to Annotation -


i receiving error of

'type mismatch: cannot convert dataprovider annotation' error @dataprovider (@line 19)

any appreciated

package parameterization;  import org.testng.annotations.test;  import org.testng.annotations.dataprovider;  public class dataprovider  {     //this test method declares data should supplied data provider         // "getdata" function name passing data            // number of columns should match number of input parameters         @test(dataprovider="getdata")         public void setdata(string username, string password)         {             system.out.println("you have provided username as::"+username);             system.out.println("you have provided password as::"+password);         }          @dataprovider(name="getdata")         public object[][] getdata()         {         //rows - number of times test has repeated.         //columns - number of parameters in test data.         object[][] data = new object[3][2];          // 1st row         data[0][0] ="sampleuser1";         data[0][1] = "abcdef";          // 2nd row         data[1][0] ="testuser2";         data[1][1] = "zxcvb";          // 3rd row         data[2][0] ="guestuser3";         data[2][1] = "pass123";          return data;         }    } 

thank you.

your class name dataprovider , hides import import org.testng.annotations.dataprovider.

in line error think use later, use former.

solution: either rename class or use fqn in annatation (@org.testng.annotations.dataprovider(name="getdata")).


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -