简体   繁体   English

想要使用来自同一公共类的另一个公共方法中的所有数据成员调用一个公共方法

[英]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. 我不理解为什么数据成员无法访问方法“ testAddKOL”,因为我通过创建相同类的对象来调用整个方法。

@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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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