数据提供程序不匹配错误

时间:2018-03-13 03:45:43

标签: selenium testng-dataprovider

我正在使用下面的数据提供程序代码,但它不起作用。请帮助我解决数据提供程序不匹配问题。这里提到了有关阅读xls,test,data provider的所有方法的完整细节。

int ID = 120120;
Button yourButton = (Button)findViewById(R.id.button);
yourButton.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent(
                Intent.ACTION_VIEW,
                Uri.parse("http://www.domain.xyz/printrecords.php?classid="+ID));
        startActivity(intent);
    }
});

//使用以下方法从excel中读取数据

responseText

2 个答案:

答案 0 :(得分:0)

看起来测试需要5个参数,但数据提供者方法getTestData传递的参数更少/更多。

答案 1 :(得分:0)

您传递的参数数量错误。方法String[]需要5个参数,但只接收一个。您可以在错误消息的最后一行中看到它

  

参数:[(java.lang.String)fname]

如果要传递不同数量的参数,可以使用data而不是单个参数。如果您希望每次检查5个参数,请检查getTestData()

中{{1}}的含义