DDF 3.x version has only support for TestNG, with the DDF 4.0 version you can use DataDrivenFramework with out using TestNG API.
Current implementation of DataDrivenFramework can be integrated with any automation tool/api which supports java (ex: Java Webdriver, Openscript, etc). It can also be used as part of application development for reading the data from XML file.
For information on other DDF versions click link DataDrivenFramework.
1. Prerequisite:
i. Java 1.6
ii. Eclipse IDE or any other Java IDE (ex: NetBeans IDE)
3. Extract the "DDF Version - 4.0.zip" (zip file contains example programs and jar file).
4. Set "AH-DDF-4.0.jar" in java build path.
Note:
'AH-DDF-<<Version>>.jar' is proprietary jar file, distributed for free.
Java Build Path:
Test Data:
Sample Program:
package examples.Non_TestNG_test.xml;
import java.io.File;
import java.util.List;
import java.util.Map;
import automation_home.ddf.constants.XMLConstants;
import automation_home.ddf.wrapper.Wrapper;
import automation_home.ddf.wrapperimpl.XMLWrapper;
public class TestData {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
for(Map<String, String> h : configure()){
System.out.println("FlightName : "+h.get("FlightName"));
System.out.println("FlightNumber : "+h.get("FlightNumber"));
System.out.println("AirPort : "+h.get("AirPort"));
System.out.println("Date : "+h.get("Date"));
System.out.println("----------------------------------------");
}
}
public static List<Map<String, String>> configure() throws Exception{
Wrapper wrapper = new XMLWrapper();
wrapper.setParameter(XMLConstants.FILE_PATH, new File("").getAbsolutePath()+"\\src\\examples\\Non_TestNG_test\\xml\\FlightInfo.xml");
wrapper.setParameter(XMLConstants.NODE_NAME, "flight-details");
wrapper.setParameter(XMLConstants.INCLUDE_TESTDATA_HEADER_NAME, "TestInclude");
wrapper.setParameter(XMLConstants.INCLUDE_TESTDATA_YES,"true");
wrapper.setParameter(XMLConstants.INCLUDE_TESTDATA_NO,"false");
List<Map<String, String>> list = wrapper.retrieveData();
return list;
}
}
Output:
No comments:
Post a Comment