Open juherr opened 7 years ago
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Default Suite">
<test name="testng">
<classes>
<class name="test.factory.github1082.GitHub1082Sample">
<methods>
<include name="testA" invocation-numbers="1"/>
</methods>
</class>
</classes>
</test> <!-- testng -->
</suite> <!-- Default Suite -->
package test.factory.github1082;
import org.testng.ITest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
@Test(testName = "test")
public class GitHub1082Sample implements ITest {
private final boolean value;
private String testName;
@Factory(dataProvider = "dp")
public GitHub1082Sample(boolean value) {
this.value = value;
}
@DataProvider
public static Object[][] dp() {
return new Object[][]{
new Object[]{false},
new Object[]{true}
};
}
@BeforeMethod
public void setUp(Method method) {
testName = method.getName();
}
public void testA() {
}
public void testB() {
}
@Override
public String getTestName() {
return testName + "(" + value + ")";
}
}
Same issue with factory only:
@Test(testName = "test")
public class GitHub1082Sample implements ITest {
private final boolean value;
private String testName;
public GitHub1082Sample(boolean value) {
this.value = value;
}
@Factory
public static Object[] dp() {
return new Object[]{
new GitHub1082Sample(false),
new GitHub1082Sample(true)
};
}
@BeforeMethod
public void setUp(Method method) {
testName = method.getName();
}
public void testA() {
}
public void testB() {
}
@Override
public String getTestName() {
return testName + "(" + value + ")";
}
Could be related to #1448
From http://stackoverflow.com/q/40766863/4234729