Feature file:
Scenario: Login to application
Given I open my application
And I login with following credentials
| admin | pass1234 |
StepDefs:
@When("^I login with following credentials$")
public void i_login_with_following_credentials(DataTable dt) {
List<String> list = dt.asList(String.class);
System.out.println("Username - " + list.get(0));
System.out.println("Password - " + list.get(1));
}
The error:
io.cucumber.datatable.UndefinedDataTableTypeException: Can't convert DataTable to List<java.lang.String>.
There was a table cell converter but the table was too wide to use it.
Please reduce the table width or register a TableEntryTransformer or TableRowTransformer for java.lang.String.
<cucumber.version>5.4.1</cucumber.version>
<junit.version>4.13</junit.version>
Could you please advice? What exactly should be added? Thank you.
dataTable.asList()
does the job. Is there a way to register this behaviour as default for list of strings? – Colson