Home > Back-end >  TestNg use DataProvider said error is not defined parameters, the actual is defined, which bosses to
TestNg use DataProvider said error is not defined parameters, the actual is defined, which bosses to

Time:09-26

[ERROR] Tests run: 1, Failures: 1, the Errors: 0, Skipped: 0, Time elapsed: 1.744 s & lt; [ERROR] refuse (com) qa) tests. The RefuseClassificationTest) Time elapsed: 1.585 s & lt; Org. Testng. Internal. Reflect. MethodMatcherException:

[public void com. Qa. Tests. RefuseClassificationTest. Refuse (Java. Lang. String, Java. Lang. String, Java, lang, String, Java, lang, String, int) throws org. Apache. HTTP. Client. ClientProtocolException, Java, IO, IOException] has no parameters defined but was found to be using a data provider (either explicitly specified or inherited from class level annotation).
The Data provider mismatch
Method: refuse ([Parameter {index=0, type=Java. Lang. String, declaredAnnotations=[]}, the Parameter {index=1, type=Java. Lang. String, declaredAnnotations=[]}, the Parameter {index=2, type=Java. Lang. String, declaredAnnotations=[]}, the Parameter {index=3, type=Java. Lang. String, declaredAnnotations=[]}, the Parameter {index=4, type=int, declaredAnnotations=[]}])
The Arguments: [(Java. Lang. String)/voiceRubbish/disti, (Java. Lang. String), 8 f85dec7edd82f67e60031821bd72d5b (Java. Lang. String) E: \ \ Eclipse \ \ workspace \ \ myInterface \ \ SRC \ \ the main \ \ resources \ \ rubbish, PCM (Java. Lang. String), PCM (Java. Lang. String) 2]

The actual code is a parameter, as follows:
@ DataProvider (name="voicedata")
Public Object [] [] data () throws IOException {
String data=https://bbs.csdn.net/topics/prop.getProperty (" voiceRefuseClassification_data ");
Return testUtil. GetExcelData (data, "test");
}

@ Test (dataProvider="voicedata")
Public void refuse (url String, the String key, String researched, String format, int type)
Throws ClientProtocolException, IOException {
RefuseClassificationParam param=new RefuseClassificationParam (key, researched, the format, type);
String entityString=JSON. ToJSONString (param);
.
Study for two days, still don't know where is the problem, which bosses to give directions? !
  • Related