Search in sources :

Example 11 with DataTableRow

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;
}
Also used : ArrayList(java.util.ArrayList) DataTableRow(gherkin.formatter.model.DataTableRow)

Example 12 with DataTableRow

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;
}
Also used : ArrayList(java.util.ArrayList) DataTableRow(gherkin.formatter.model.DataTableRow)

Example 13 with DataTableRow

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());
    }
}
Also used : Argument(gherkin.formatter.Argument) Step(gherkin.formatter.model.Step) LocalizedXStreams(cucumber.runtime.xstream.LocalizedXStreams) ArrayList(java.util.ArrayList) List(java.util.List) Arrays.asList(java.util.Arrays.asList) DataTableRow(gherkin.formatter.model.DataTableRow) I18n(gherkin.I18n) Test(org.junit.Test)

Example 14 with DataTableRow

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);
        }
    }
}
Also used : DataTableRow(gherkin.formatter.model.DataTableRow) Then(cucumber.api.java.en.Then)

Example 15 with DataTableRow

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);
    }
}
Also used : DataTableRow(gherkin.formatter.model.DataTableRow) Given(cucumber.api.java.en.Given)

Aggregations

DataTableRow (gherkin.formatter.model.DataTableRow)46 ArrayList (java.util.ArrayList)17 Test (org.junit.Test)9 List (java.util.List)6 And (cucumber.api.java.en.And)5 DataTable (cucumber.api.DataTable)4 DocString (gherkin.formatter.model.DocString)4 Step (gherkin.formatter.model.Step)4 Given (cucumber.api.java.en.Given)3 Then (cucumber.api.java.en.Then)3 LocalizedXStreams (cucumber.runtime.xstream.LocalizedXStreams)3 ExamplesTableRow (gherkin.formatter.model.ExamplesTableRow)3 Argument (gherkin.formatter.Argument)2 Arrays.asList (java.util.Arrays.asList)2 Map (java.util.Map)2 Pair (org.activityinfo.model.util.Pair)2 Usage (alien4cloud.model.common.Usage)1 Delta (cucumber.deps.difflib.Delta)1 I18n (gherkin.I18n)1 Row (gherkin.formatter.model.Row)1