简体   繁体   中英

Want to call a public method with all data members in another public method from same public class

Want to call a public method with all data members in another public method from same public class.

I am not understanding why datamembers are not getting access of method "testAddKOL" as I am calling a whole method by creating an object of same class.

@Test(dataProvider = "datatest")
public void testAddKOL(Map data) throws Exception {

    String kolname = (String) data.get("kolname");
    String kolemail = (String) data.get("kolemail");

    mouseOver(mykol.mousehoverKOLlist);
    waitforelementpresent(mykol.addicon);
    click(mykol.addicon);

}

@Test(dataProvider = "datatest")
public void addkoltoList(Map data) throws Exception {

    MyKOL add = new MyKOL();
    add.testAddKOL(data); // calling a method by creating the object

    waitforelementpresent(mykol.mousehoverKOLlist);

    mouseOver(mykol.mousehoverKOLlist);

}

Instead the creating class object & calling the method:

MyKOL add = new MyKOL(); add.testAddKOL(data);

Just call the method:

testAddKOL(data);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM