I have several WebdriverSelenium / TestNG / Maven / Java integration tests that I reorganized (removed a huge inheritance chain), and now I also installed the Spring DI framework.
I just can't pass parameters to the Test method (oneUserTwoUser)
This is a 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 a test class:
open 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 {
Mistake
org.testng.TestNGException: Parameter 'driver' is required by @Test on method oneUserTwoUser but has not been marked @Optional or defined
java spring testng
Jk
source share