All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qmetry.qaf.automation.cucumber.bdd2.parser.Bdd2Pickle Maven / Gradle / Ivy

Go to download

Functional test automation framework for web, mobile-web, mobile native and web-service

There is a newer version: 4.0.0-RC3
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy