com.qmetry.qaf.automation.cucumber.bdd2.parser.Bdd2Pickle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of qaf-cucumber Show documentation
Show all versions of qaf-cucumber Show documentation
Functional test automation framework for web, mobile-web, mobile native and web-service
package com.qmetry.qaf.automation.cucumber.bdd2.parser;
import static com.qmetry.qaf.automation.data.MetaDataScanner.formatMetaData;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import gherkin.ast.TableCell;
import gherkin.pickles.Pickle;
import gherkin.pickles.PickleLocation;
import gherkin.pickles.PickleStep;
import gherkin.pickles.PickleTag;
/**
*
* @author chirag.jayswal
*
*/
public class Bdd2Pickle extends Pickle {
private Map metaData;
private Map testData;
public Bdd2Pickle(String name, String language, List steps, List tags,
List locations, Map metaData) {
super(name, language, steps, tags, locations);
initMetaData(metaData);
}
public Bdd2Pickle(String name, String language, List steps, List tags,
List locations, List headerCells, List valueCells, Map metaData) {
this(name, language, steps, tags, locations, metaData);
testData = new TreeMap(String.CASE_INSENSITIVE_ORDER);
Iterator keys = headerCells.iterator();
Iterator values = valueCells.iterator();
while (values.hasNext() && keys.hasNext()) {
testData.put(keys.next().getValue(), values.next().getValue());
}
}
public Map getMetaData() {
return metaData;
}
public Map getTestData() {
return testData;
}
private void initMetaData(Map inMetaData) {
metaData=new TreeMap(String.CASE_INSENSITIVE_ORDER);
metaData.putAll(inMetaData);
metaData.put("name", getName());
formatMetaData(metaData);
}
}