本文整理汇总了Java中gherkin.ast.Examples.getTableBody方法的典型用法代码示例。如果您正苦于以下问题:Java Examples.getTableBody方法的具体用法?Java Examples.getTableBody怎么用?Java Examples.getTableBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gherkin.ast.Examples
的用法示例。
在下文中一共展示了Examples.getTableBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertGherkinExampleTableToCucableExampleMap
import gherkin.ast.Examples; //导入方法依赖的package包/类
/**
* Converts a Gherkin example table to a map of columns (keys) and rows (values)
*
* @param exampleTable a Gherkin {@link Examples} instance.
* @return a map where the keys are the column headers and the values are lists of strings.
*/
Map<String, List<String>> convertGherkinExampleTableToCucableExampleMap(Examples exampleTable) {
Map<String, List<String>> exampleMap = new LinkedHashMap<>();
List<TableCell> headerCells = exampleTable.getTableHeader().getCells();
for (TableCell headerCell : headerCells) {
exampleMap.put("<" + headerCell.getValue() + ">", new ArrayList<>());
}
Object[] columnKeys = exampleMap.keySet().toArray();
List<TableRow> tableBody = exampleTable.getTableBody();
for (TableRow tableRow : tableBody) {
List<TableCell> cells = tableRow.getCells();
for (int i = 0; i < cells.size(); i++) {
String columnKey = (String) columnKeys[i];
List<String> values = exampleMap.get(columnKey);
values.add(cells.get(i).getValue());
}
}
return exampleMap;
}
示例2: scenarios
import gherkin.ast.Examples; //导入方法依赖的package包/类
private List<ScenarioDefinition> scenarios(Feature feature)
{
List<ScenarioDefinition> result = new ArrayList<>();
for (ScenarioDefinition scenario : feature.getChildren())
{
if (isScenarioNormal(scenario))
{
result.add(scenario);
}
else if (isScenarioOutline(scenario))
{
ScenarioOutline scenarioOutline = (ScenarioOutline) scenario;
for (Examples examples : scenarioOutline.getExamples())
{
for (TableRow row : examples.getTableBody())
{
result.add(concreteScenario(scenarioOutline, parametersMap(examples.getTableHeader(), row)));
}
}
}
}
return result;
}
示例3: matchingExamples
import gherkin.ast.Examples; //导入方法依赖的package包/类
private Collection<ScenarioAndLocation> matchingExamples(final ScenarioOutline scenario,
final Set<Tag> allTagsForScenario) {
final Collection<ScenarioAndLocation> matchingRows =
new LinkedList<ScenarioAndLocation>();
for (final Examples example : scenario.getExamples()) {
final Collection<Tag> allTagsForExample = new HashSet<Tag>(allTagsForScenario);
allTagsForExample.addAll(example.getTags());
if (matches(allTagsForExample)) {
for (TableRow row : example.getTableBody()) {
matchingRows.add(new ScenarioAndLocation(scenario, row.getLocation()));
}
}
}
return matchingRows;
}
示例4: compileScenarioOutline
import gherkin.ast.Examples; //导入方法依赖的package包/类
private void compileScenarioOutline(List<Pickle> pickles, List<PickleStep> backgroundSteps, ScenarioOutline scenarioOutline, List<Tag> featureTags, String path) {
if (scenarioOutline.getSteps().isEmpty())
return;
int exampleCount = 1;
for (final Examples examples : scenarioOutline.getExamples()) {
if (examples.getTableHeader() == null) continue;
List<TableCell> variableCells = examples.getTableHeader().getCells();
for (final TableRow values : examples.getTableBody()) {
List<TableCell> valueCells = values.getCells();
List<PickleStep> steps = new ArrayList<>();
steps.addAll(backgroundSteps);
List<Tag> tags = new ArrayList<>();
tags.addAll(featureTags);
tags.addAll(scenarioOutline.getTags());
tags.addAll(examples.getTags());
for (Step scenarioOutlineStep : scenarioOutline.getSteps()) {
String stepText = interpolate(scenarioOutlineStep.getText(), variableCells, valueCells);
// TODO: Use an Array of location in DataTable/DocString as well.
// If the Gherkin AST classes supported
// a list of locations, we could just reuse the same classes
PickleStep pickleStep = new PickleStep(
stepText,
createPickleArguments(scenarioOutlineStep.getArgument(), variableCells, valueCells, path),
asList(
pickleLocation(values.getLocation(), path),
pickleStepLocation(scenarioOutlineStep, path)
),
scenarioOutlineStep.getKeyword().trim()
);
steps.add(pickleStep);
}
Pickle pickle = new Pickle(
interpolate(scenarioOutline.getName(), variableCells, valueCells)+ " Example No." + exampleCount++,
steps,
pickleTags(tags, path),
asList(
pickleLocation(values.getLocation(), path),
pickleLocation(scenarioOutline.getLocation(), path)
)
);
pickles.add(pickle);
}
}
}
示例5: compileScenarioOutline
import gherkin.ast.Examples; //导入方法依赖的package包/类
private void compileScenarioOutline(List<Pickle> pickles, List<PickleStep> backgroundSteps, ScenarioOutline scenarioOutline, List<Tag> featureTags) {
if (scenarioOutline.getSteps().isEmpty())
return;
for (final Examples examples : scenarioOutline.getExamples()) {
if (examples.getTableHeader() == null) continue;
List<TableCell> variableCells = examples.getTableHeader().getCells();
for (final TableRow values : examples.getTableBody()) {
List<TableCell> valueCells = values.getCells();
List<PickleStep> steps = new ArrayList<>();
steps.addAll(backgroundSteps);
List<Tag> tags = new ArrayList<>();
tags.addAll(featureTags);
tags.addAll(scenarioOutline.getTags());
tags.addAll(examples.getTags());
for (Step scenarioOutlineStep : scenarioOutline.getSteps()) {
String stepText = interpolate(scenarioOutlineStep.getText(), variableCells, valueCells);
// TODO: Use an Array of location in DataTable/DocString as well.
// If the Gherkin AST classes supported
// a list of locations, we could just reuse the same classes
PickleStep pickleStep = new PickleStep(
stepText,
createPickleArguments(scenarioOutlineStep.getArgument(), variableCells, valueCells),
asList(
pickleLocation(values.getLocation()),
pickleStepLocation(scenarioOutlineStep)
)
);
steps.add(pickleStep);
}
Pickle pickle = new Pickle(
interpolate(scenarioOutline.getName(), variableCells, valueCells),
steps,
pickleTags(tags),
asList(
pickleLocation(values.getLocation()),
pickleLocation(scenarioOutline.getLocation())
)
);
pickles.add(pickle);
}
}
}
示例6: compileScenarioOutline
import gherkin.ast.Examples; //导入方法依赖的package包/类
private void compileScenarioOutline(List<Pickle> pickles, List<PickleStep> backgroundSteps, ScenarioOutline scenarioOutline, List<Tag> featureTags, String language) {
for (final Examples examples : scenarioOutline.getExamples()) {
if (examples.getTableHeader() == null) continue;
List<TableCell> variableCells = examples.getTableHeader().getCells();
for (final TableRow values : examples.getTableBody()) {
List<TableCell> valueCells = values.getCells();
List<PickleStep> steps = new ArrayList<>();
if (!scenarioOutline.getSteps().isEmpty())
steps.addAll(backgroundSteps);
List<Tag> tags = new ArrayList<>();
tags.addAll(featureTags);
tags.addAll(scenarioOutline.getTags());
tags.addAll(examples.getTags());
for (Step scenarioOutlineStep : scenarioOutline.getSteps()) {
String stepText = interpolate(scenarioOutlineStep.getText(), variableCells, valueCells);
// TODO: Use an Array of location in DataTable/DocString as well.
// If the Gherkin AST classes supported
// a list of locations, we could just reuse the same classes
PickleStep pickleStep = new PickleStep(
stepText,
createPickleArguments(scenarioOutlineStep.getArgument(), variableCells, valueCells),
asList(
pickleLocation(values.getLocation()),
pickleStepLocation(scenarioOutlineStep)
)
);
steps.add(pickleStep);
}
Pickle pickle = new Pickle(
interpolate(scenarioOutline.getName(), variableCells, valueCells),
language,
steps,
pickleTags(tags),
asList(
pickleLocation(values.getLocation()),
pickleLocation(scenarioOutline.getLocation())
)
);
pickles.add(pickle);
}
}
}