Closed AndreyMatveyev closed 6 years ago
@AndreyMatveyev
I used a sample which looks like below with TestNG 6.10 and I am not able to reproduce the issue.
public class Github1278 {
@DataProvider
public Iterator<Object[]> getData(Method method) {
List<Object[]> objects = new ArrayList<>();
objects.add(new Object[]{new Student("Jack")});
objects.add(new Object[]{new Student("Jill")});
objects.add(new Object[]{new Student("Rambo")});
objects.add(new Object[]{new Student("Sherkhan")});
return objects.iterator();
}
@Test(dataProvider = "getData")
public void testMethod(Student s) {
URL url = TestNG.class.getProtectionDomain().getCodeSource().getLocation();
String version = new File(url.getFile()).getParentFile().getName();
System.err.println("Running with TestNG " + version);
Assert.assertNotNull(s.getName());
}
public static class Student {
String name;
public Student(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
}
Here's the output I see:
Running with TestNG 6.10
Running with TestNG 6.10
Running with TestNG 6.10
Running with TestNG 6.10
===============================================
Default Suite
Total tests run: 4, Failures: 0, Skips: 0
===============================================
Thank you for the quick turnaround. We'll try to replicate it in our environments again by using our code and the test code provided in the issue.
Just one note; in the provided test which replicates the issue the signature is different comparing to the original case.
The test uses
public static Iterator<Object[]> myDataProvider(Method m)
and the original code uses
public static Iterator<Object> myDataProvider(Method m)
Closing this issue since there's no update from the user. Please comment if this is still a problem.
TestNG Version
6.10.0.201612030230
Expected behavior
For data provider with signature
public static Iterator<Object> myDataProvider(Method m)
the test method with signaturepublic void myTestMethod(TestCaseData testCaseData)
should work as it worked before in the previous version of TestNG 6.9.13.201609291640Actual behavior
For data provider with signature
public static Iterator<Object> myDataProvider(Method m)
the test method with signaturepublic void myTestMethod(TestCaseData testCaseData)
fails with error "data provider mismatch" the same implementation works fine with previous version of TestNG 6.9.13.201609291640notes:
Is the issue reproductible on runner?
Test case sample