use of io.cucumber.plugin.event.DataTableArgument in project cucumber-jvm by cucumber.
the class SnippetGenerator method arguments.
private Map<String, Type> arguments(Step step, List<String> parameterNames, List<ParameterType<?>> parameterTypes) {
Map<String, Type> arguments = new LinkedHashMap<>(parameterTypes.size() + 1);
for (int i = 0; i < parameterTypes.size(); i++) {
ParameterType<?> parameterType = parameterTypes.get(i);
String parameterName = parameterNames.get(i);
arguments.put(parameterName, parameterType.getType());
}
StepArgument arg = step.getArgument();
if (arg == null) {
return arguments;
} else if (arg instanceof DocStringArgument) {
arguments.put(parameterName("docString", parameterNames), String.class);
} else if (arg instanceof DataTableArgument) {
arguments.put(parameterName("dataTable", parameterNames), DataTable.class);
}
return arguments;
}
use of io.cucumber.plugin.event.DataTableArgument in project cucumber-jvm by cucumber.
the class JsonFormatter method createTestStep.
private Map<String, Object> createTestStep(PickleStepTestStep testStep) {
Map<String, Object> stepMap = new HashMap<>();
stepMap.put("name", testStep.getStepText());
stepMap.put("line", testStep.getStepLine());
TestSourcesModel.AstNode astNode = testSources.getAstNode(currentFeatureFile, testStep.getStepLine());
StepArgument argument = testStep.getStepArgument();
if (argument != null) {
if (argument instanceof DocStringArgument) {
DocStringArgument docStringArgument = (DocStringArgument) argument;
stepMap.put("doc_string", createDocStringMap(docStringArgument));
} else if (argument instanceof DataTableArgument) {
DataTableArgument dataTableArgument = (DataTableArgument) argument;
stepMap.put("rows", createDataTableList(dataTableArgument));
}
}
if (astNode != null) {
Step step = (Step) astNode.node;
stepMap.put("keyword", step.getKeyword());
}
return stepMap;
}
Aggregations