Passing parameters to testNG provider

Deanganycle

New Member
I'm new to this and I would like to just understand a few things, if anyone can help me.\[code\]@DataProvider(name="test1")public Object[][] provideTestParam(ITestContext context){ String testParam = context.getCurrentXmlTest().getParameter(test_param); return new Object[][]{{ testParam }};}@Test(dataProvider="test1")public void testData(String data){ //...}\[/code\][*]Does anyone know what is \[code\]test_param\[/code\]? Is it a file name, a method some parameter in the testng.xml file?[*]I looked at a javadoc for \[code\]ITestContext\[/code\] and I don't clearly understand how does \[code\]getParameter\[/code\] work. Does it get a single hash map from the xml file that the data is coming from? Or does it get all key value pairs from the xml file that the data is coming from?[*]All I want to do is have an xml file stored in my project and use the data from the xml file. Feed it to the dataprovider and run my tests. Is there another way to do this?
 
Back
Top