Discussion:
[Cucumber] how can i successfully set ":" after a scenario outline variable ?
(too old to reply)
j***@gmail.com
2018-04-07 13:16:26 UTC
Permalink
Raw Message
When using CucumberJVM to write feature files, when passing in the
variables from the scenario outline examples table, I am unable to get the
steps to recognise a variable followed by ":".

Step definition:


@Given("^the following (.*) (.*): (.*)$")


*Successfully *detects this:


Given the following standard user: <username>


Does *not *detect this:


Given the following standard <account-type>: <username>


I want the best of both worlds, but when passing a variable from this
example table for <account-type> the step is not recognised by cucumber.

Examples:
| username | account-type |
| Jason | user |
| Martin | manager |


How can I have the ":" symbol, detected and working within the feature file
for both of these scenarios?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
j***@gmail.com
2018-04-07 13:32:14 UTC
Permalink
Raw Message
probably caused because im mapping those values to enums?
@Given("^the following (.*) (.*) (.*)$")


public void theFollowing(UserAutomationType userType, AccountType
accountType, String username)
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
j***@gmail.com
2018-04-08 07:00:02 UTC
Permalink
Raw Message
solved, I should stop abusing the (.*)
Post by j***@gmail.com
When using CucumberJVM to write feature files, when passing in the
variables from the scenario outline examples table, I am unable to get the
steps to recognise a variable followed by ":".
@Given("^the following (.*) (.*): (.*)$")
Given the following standard user: <username>
Given the following standard <account-type>: <username>
I want the best of both worlds, but when passing a variable from this
example table for <account-type> the step is not recognised by cucumber.
| username | account-type |
| Jason | user |
| Martin | manager |
How can I have the ":" symbol, detected and working within the feature
file for both of these scenarios?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Koen Prins
2018-04-08 12:05:10 UTC
Permalink
Raw Message
Yes, that is a good rule.
What I do is put all variables in double quotes so that the regex is not
easily misfiring.
Post by j***@gmail.com
solved, I should stop abusing the (.*)
Post by j***@gmail.com
When using CucumberJVM to write feature files, when passing in the
variables from the scenario outline examples table, I am unable to get the
steps to recognise a variable followed by ":".
@Given("^the following (.*) (.*): (.*)$")
Given the following standard user: <username>
Given the following standard <account-type>: <username>
I want the best of both worlds, but when passing a variable from this
example table for <account-type> the step is not recognised by cucumber.
| username | account-type |
| Jason | user |
| Martin | manager |
How can I have the ":" symbol, detected and working within the feature
file for both of these scenarios?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...