Discussion:
[Cucumber] Cucumber Expressions > Regular Expressions
(too old to reply)
aslak hellesoy
2017-08-02 02:49:50 UTC
Permalink
Raw Message
On Tue, Aug 1, 2017 at 10:24 AM, Richard Lawrence <
I finally had a chance to read through the docs on this. Nicely done! As a
big proponent of regular expressions in Cucumber, I was skeptical when this
effort started, but I'm impressed with how this incorporates what I like
about regular expressions with what I like about growing a rich domain
language.
Thanks Richard - that's great to hear, particularly from someone like you
who's been using BDD and Cucumber since the very beginning!
Now we just need consistent support across Cucumber implementations. (I'm
especially looking forward to seeing this in Cucumber-JVM and SpecFlow,
since I get called to teach those most often.)
The Cucumber Expressions library is already implemented in Java, but it
hasn't been integrated into Cucumber-JVM yet. The library uses Java 8
features, while Cucumber-JVM is still supporting Java 7. We need to decide
whether we should a) backport Cucumber Expressions to Java 7 and continue
to support this unsupported Java version, or b) draw a line in the sand and
say that the next versions of Cucumber-JVM will require Java 8. What do you
think?

As for SpecFlow support - step 1 would be to port the Java version of
Cucumber Expressions to C# (with a pull request to cucumber), step 2 would
be to change SpecFlow to use it (with a pull request to specflow). We're
looking for contributors to help with this.
Richard
On Jul 27, 2017 9:55 AM, "aslak hellesoy"
On Thu, 27 Jul 2017 at 16:17, Tim Walker
On Wed, Jul 26, 2017 at 3:49 PM, Aslak HellesÞy
Hi folks,
We all love Regular Expressions. Or do we? Many
don't. While they are powerful, they're not
pretty, and you won't ever get anything else
than strings out of them.
Say hi to Cucumber Expressions. Not quite the
expressive power of Regular Expressions, but
gorgeous! And they can convert strings into
anything.
https://cucumber.io/blog/2017
/07/26/announcing-cucumber-expressions
Very cool. Great job! Question. Much like the
ability to control snake|camel case in snippets
generated by missing steps can we keep the regex
snippets around as an option? Thank you again, this
looks fantastic. Tim
I can't really think of a good reason to do so. Why
would you want that?
I guess because of the power and flexibility of regex. I
like and use things like optionality for pluralization and
non-capturing groups for slight syntax differences to keep
expressiveness high. Perhaps I like regex and the tools and
support that help craft them since they are standard
reusable constructs. I guess this is just supporting
backwards compatability for the skills we know.
Regexps are still supported, and won't go away. The only
difference is that if you want to use regexps, you have to
write
them yourself.
Generated regexps didn't take advantage of fancy regexp
features. If you wanted that (fancy character classes, optional
captures, negative lookahead etc) the generated ones wouldn't
be
much help qanyway.
What do you think Tim?
Understood. The patterns generated the simple general solutions
that
need twiddling anyway. I have mixed feelings about the multiple
solutions without the symmetry in the supporting approaches.
If Cucumber was released for the first time today, it would probably
only support Cucumber expressions, and not regexp. The regexp support
is
there for backwards compatibility.
In my experience, if you're reaching for the advanced features of
regexp
it's usually a symptom of a vague/inconsistent domain language.
I've mostly used regex for a/an and singular/plural situations. Does
Cucumber expressions have means to handle these?
https://docs.cucumber.io/cucumber-expressions/#optional-text
I am trying to understand if apps will use all Cucumber expressions
or a hybrid of them and regular expressions.
I'm working on an application that uses Cucumber expressions
exclusively, and I don't expect we'll ever need to use regexp. If we
do,
we'll take that as a cue to tighten our domain language and use
Cucumber
expressions instead.
For existing applications that use regexp, I see 3 equally valid
a) Continue to use regexp because that's what the team is used to
b) Use Cucumber expressions for new stepdefs, but leave existing ones
as
regexp
c) Translate all existing stepdefs to use Cucumber expressions
In Cucumber Ruby we went for c)
I suppose I don't have a strong opinion one way or the other aside
from the shared desire to keep things as simple as possible. The
clarity of the transforms is so much better with the tradeoff being
management of an additional intermediary construct to support it. I
need to toddle off and find a project to apply the new goodness!
Thanks again. Tim
Let us know how you get on with it Tim. We don't have a lot of feedback
of how it feels to use yet, except our own experience.
Aslak
Thank you again. Tim
Aslak
Cheers,
Aslak
- George
--
----------------------------------------------------------------------
* George Dinwiddie * http://blog.gdinwiddie.com
Software Development http://www.idiacomputing.com
Consultant and Coach http://www.agilemaryland.org
----------------------------------------------------------------------
--
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
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
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
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...