Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Tag Expressions #1003

Closed
aslakhellesoy opened this issue Aug 8, 2016 · 12 comments
Closed

Add support for Tag Expressions #1003

aslakhellesoy opened this issue Aug 8, 2016 · 12 comments
Milestone

Comments

@aslakhellesoy
Copy link
Contributor

Summary

Tag Expressions is a more intuitive way to specify tags in tagged hooks and on the command line's --tags argument.

Expected Behavior

Tagged Hooks should accept a single string:

Before("@foo and not @bar") do
end

Likewise, the --tags command line argument should allow the same. (Specifying it more than once should cause an error)

--tags "@foo and not @bar"

Context & Motivation

The current mechanism to specify or with comma and and with multiple --tags is incredibly awkward. Tag Expressions are intuitive!

@nodo
Copy link
Member

nodo commented Aug 25, 2016

@aslakhellesoy I am quite new to the project, but I would be happy to give this feature a try. What do you think?

@aslakhellesoy
Copy link
Contributor Author

aslakhellesoy commented Aug 25, 2016

That would be fantastic!

The first step would be to port the TagExpressions library to Ruby. See cucumber/common#60. It's a tiny codebase! Just use the JavaScript or Java code as inspiration.

When that's done, send a PR to cucumber/cucumber and I'll mirror it at https://github.com/cucumber/tag-expressions-ruby so it can be consumed as a git gem dependency from the cucumber-ruby project while you're working on it. Here is how I recommend you do that:

  • First make sure you can run all cucumber-ruby tests successfully
  • Locate all the old tag expression code and modify/delete it to use the new tag-expressions gem.
  • Update existing tests (maybe add some and delete some)
  • Send a PR to cucumber-ruby when it's working
  • If all is good, I can release tag-expressions to rubygems, and we can depend on that instead of git.

How does that sound?

@nodo
Copy link
Member

nodo commented Aug 26, 2016

Sounds good, thanks a lot @aslakhellesoy :) I am planning to dedicate some times next week and keep you updated here.

@aslakhellesoy
Copy link
Contributor Author

That's great @nodo - let us know if you have any questions. You can also try the contributors chat room.

@mattwynne
Copy link
Member

If someone wants to take a crack at integrating @nodo's work in cucumber/common#67, I'd like to ask that they help us to stay backwards-compatible for one major release by making the choice of old / new tag expression syntax a configuration option. That will enable us to transition users over to the new syntax gradually. We can make it opt-in first, then make it the default for the next major release.

@aslakhellesoy
Copy link
Contributor Author

Great work so far @nodo! I have released cucumber-tag_expressions 1.0.0!

@aslakhellesoy
Copy link
Contributor Author

I second @mattwynne's comment about backwards compatibility.

In the next version, use the new tag-expression library only if:

  • Only one --tags option is used on the CLI or only one string is passed to a tagged hook.
  • Its value doesn't contain any commas (that's old school)

Also, print a deprecation warning in the other case, telling people that:

  • They should start using the new tag expressions (link to http://docs.cucumber.io/tag-expressions/)
    • We might need to add a migration guide here with some examples
  • Old school tag expressions will go away in the next major version
    • No more multiple --tags on the CLI or multiple strings passed to tagged hooks - that's an error
    • No more commas in tag strings (that's a tag expression parse error)

WDYT?

@nodo
Copy link
Member

nodo commented Sep 2, 2016

Sounds good @aslakhellesoy , I will give it a try and keep you updated.

Thanks for the hints.

@mattwynne
Copy link
Member

Automatic identification of legacy tag expressions (with a deprecation warning) would be awesome UX if we can achieve that.

Remember tags are used in hooks as well as on the CLI.

@mattwynne mattwynne added this to the 4.0 milestone Sep 2, 2016
@aslakhellesoy
Copy link
Contributor Author

Hi @nodo did you make any progress on this?

@nodo
Copy link
Member

nodo commented Oct 30, 2016

@aslakhellesoy not yet, after seeing added to milestone 4.0 I thought to concentrate on #954. I would like to pick it up asap though.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants