I have some WebdriverSelenium/TestNG/Maven/Java continuous integration tests, that I refactored (removed a huge chain of inheritances) and now I've also installed Spring DI framework.
I just cant pass the parameters to the Test method (oneUserTwoUser)
This is the dataprovider
public class AppData {
public static WebDriver driver;
public static WebDriverWait wait;
final static String FILE_PATH = "src/test/resources/250.csv";
final static String FILE_PATH2 = "src/test/resources/places.csv";
public static ArrayList<ArrayList<String>> array;
public static Object[][] setUp() throws Exception {
//prepare data
//read data from CSV files
array = getCSVContent(FILE_PATH, 5);
array2 = getCSVContent(FILE_PATH2, 7);
//pass the data to the test case
Object[][] setUp = new Object[1][3];
setUp[0][0] = driver;
setUp[0][1] = wait;
setUp[0][2] = array;
return setUp;
}
This is the test class:
public class AppTest3 {
public static AppData appdata;
public static void main (String[] args) {
BeanFactory beanfactory = new XmlBeanFactory(new FileSystemResource("spring.xml"));
appdata = (AppData) beanfactory.getBean("data");
}
@Parameters({ "driver", "wait", "array" })
@Factory(dataProviderClass = AppData.class, dataProvider = "setUp")
@Test
public void oneUserTwoUser(WebDriver driver, WebDriverWait wait, ArrayList<ArrayList<String>> array) throws Exception {
Error
org.testng.TestNGException:
Parameter 'driver' is required by @Test on method oneUserTwoUser but has not been marked @Optional or defined