You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Including capturing groups in another one in a step annotation RegExp makes cucumber throws StringIndexOutOfBoundsException.
Expected Behavior
Parse this line of cucumber :
Then reset x table on y except z
Where the except part is optionnal
Current Behavior
The line is well executed by cucumber but at the end of the feature (or after the end) it throws this exception :
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.041 sec <<< FAILURE! - in
[...]
java.lang.StringIndexOutOfBoundsException: String index out of range: -Z
Where Z is the length of the parameter except
Possible Solution
Create a glue method like this :
@Given("reset (.+) table on ([A-Za-z_-]+)(?: except (.+))?")
public void doResetTableWithExcept(String table, String schema, String except) throws SQLException {
This way except keyword is not in a capturing group and makes cucumber work.
Steps to Reproduce (for bugs)
Create a glue method like this :
@Given("reset (.+) table on ([A-Za-z_-]+)( except (.+))?")
public void doResetTableWithExcept(String table, String schema, String exceptPart, String except) throws SQLException {
This way except keyword is in a capturing group and makes cucumber throw the exception.
@Bludwarf Please note you're using an old version of Cucumber. Try upgrading to a newer version. (Currently at v3.0.0 - which is not even a week old). Note that the <groupId>info.cukes</groupId> was changed to <groupId>io.cucumber</groupId> as of v2.0.0
Summary
Including capturing groups in another one in a step annotation RegExp makes cucumber throws StringIndexOutOfBoundsException.
Expected Behavior
Parse this line of cucumber :
Where the
except
part is optionnalCurrent Behavior
The line is well executed by cucumber but at the end of the feature (or after the end) it throws this exception :
Where
Z
is the length of the parameter exceptPossible Solution
Create a glue method like this :
This way
except
keyword is not in a capturing group and makes cucumber work.Steps to Reproduce (for bugs)
Create a glue method like this :
This way
except
keyword is in a capturing group and makes cucumber throw the exception.Context & Motivation
Your Environment
pom.xml extract :
The text was updated successfully, but these errors were encountered: