use of gherkin.formatter.model.DataTableRow in project cucumber-jvm by cucumber.
the class FromDataTableTest method listOfDoublesWithoutHeader.
private List<DataTableRow> listOfDoublesWithoutHeader() {
List<DataTableRow> rows = new ArrayList<DataTableRow>();
rows.add(new DataTableRow(NO_COMMENTS, asList("100.5", "99.5"), 2));
rows.add(new DataTableRow(NO_COMMENTS, asList("0.5", "-0.5"), 2));
rows.add(new DataTableRow(NO_COMMENTS, asList("1000", "999"), 2));
return rows;
}
use of gherkin.formatter.model.DataTableRow in project cucumber-jvm by cucumber.
the class FromDataTableTest method transposedListOfDatesAndNamesWithHeader.
private List<DataTableRow> transposedListOfDatesAndNamesWithHeader() {
List<DataTableRow> rows = new ArrayList<DataTableRow>();
rows.add(new DataTableRow(NO_COMMENTS, asList("Birth Date", "1957-05-10"), 1));
rows.add(new DataTableRow(NO_COMMENTS, asList("Name", "Sid Vicious"), 2));
return rows;
}
use of gherkin.formatter.model.DataTableRow in project cucumber-jvm by cucumber.
the class StepDefinitionMatchTest method throws_arity_mismatch_exception_when_there_are_more_parameters_than_arguments.
@Test
public void throws_arity_mismatch_exception_when_there_are_more_parameters_than_arguments() throws Throwable {
Step step = new Step(null, "Given ", "I have 4 cukes in my belly", 1, new ArrayList<DataTableRow>(), null);
StepDefinition stepDefinition = new StubStepDefinition(new Object(), WithTwoParams.class.getMethod("withTwoParams", Integer.TYPE, Short.TYPE, List.class), "some pattern");
StepDefinitionMatch stepDefinitionMatch = new StepDefinitionMatch(asList(new Argument(7, "4")), stepDefinition, null, step, new LocalizedXStreams(getClass().getClassLoader()));
try {
stepDefinitionMatch.runStep(new I18n("en"));
fail();
} catch (CucumberException expected) {
assertEquals("Arity mismatch: Step Definition 'withTwoParams' with pattern [some pattern] is declared with 3 parameters. However, the gherkin step has 2 arguments [4, Table:[]]. \n" + "Step: Given I have 4 cukes in my belly", expected.getMessage());
}
}
use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class DataEntrySteps method opened_form_has_subform_keyed_values.
@Then("^opened form has \"([^\"]*)\" subform keyed values:$")
public void opened_form_has_subform_keyed_values(String subformName, DataTable expectedSubformValues) throws Throwable {
BsModal modal = currentOpenedForm();
DataTableRow header = expectedSubformValues.getGherkinRows().get(0);
DataTableRow type = expectedSubformValues.getGherkinRows().get(1);
SubformContainer subform = modal.subform(subformName);
for (int i = 2; i < expectedSubformValues.getGherkinRows().size(); i++) {
DataTableRow row = expectedSubformValues.getGherkinRows().get(i);
String keyLabel = row.getCells().get(0);
subform.selectKey(keyLabel);
for (int j = 1; j < header.getCells().size(); j++) {
String label = driver.getAliasTable().getAlias(header.getCells().get(j));
String currentValue = modal.form().findFieldByLabel(label).getValue(ControlType.fromValue(type.getCells().get(j)));
assertEquals(row.getCells().get(j), currentValue);
}
}
}
use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class DatabaseSetupSteps method I_submitted_forms_with.
@Given("^I have submitted \"([^\"]*)\" forms with:$")
public void I_submitted_forms_with(String formName, DataTable table) throws Throwable {
DataTableRow header = table.getGherkinRows().get(0);
List<DataTableRow> rows = table.getGherkinRows().subList(1, table.getGherkinRows().size());
for (int i = 0; i < rows.size(); ++i) {
List<FieldValue> fieldValues = Lists.newArrayList();
for (int j = 0; j < header.getCells().size(); ++j) {
fieldValues.add(new FieldValue(header.getCells().get(j), rows.get(i).getCells().get(j)));
}
driver.setup().submitForm(formName, fieldValues);
}
}
Aggregations