How can I exclude several tags in cucumber without mentioning --tags ~@ for each tag

5,078 views
Skip to first unread message

Alexander Khozya

unread,
Apr 22, 2013, 3:58:20 AM4/22/13
to cu...@googlegroups.com
System: OS X 10.8.3, Cucumber: 1.2.1, Ruby: 1.8.7

Hi! I'm using calabash-cucumber and I need to exclude several tags from my test run?

Let's assume I have a feature with three tests tagged @iphone @ipad @ipod

If I run my tests with key --tags ~@ipad it works correct - two tests are ran: @iphone, @ipod
If I run my tests like this: --tags ~@ipad,~@iphone - all three are ran: @ipad, @iphone, @ipod
If I tun my tests like this: --tags ~@ipad,@ipod - two tests are ran: @iphone, @ipod

The only option that I've found is to add --tags ~@tag for each tag to run properly, but as for me it's not the best way :)

Is it a bug, or it's by design?

Cheers, 
Alex


Oleg Sukhodolsky

unread,
Apr 22, 2013, 4:04:44 AM4/22/13
to cu...@googlegroups.com
Here is what "cucumber --help" says about --tags
        Only execute the features or scenarios with tags matching TAG_EXPRESSION.
        Scenarios inherit tags declared on the Feature level. The simplest
        TAG_EXPRESSION is simply a tag. Example: --tags @dev. When a tag in a tag
        expression starts with a ~, this represents boolean NOT. Example: --tags ~@dev.
        A tag expression can have several tags separated by a comma, which represents
        logical OR. Example: --tags @dev,@wip. The --tags option can be specified
        several times, and this represents logical AND. Example: --tags @foo,~@bar --tags @zap.
        This represents the boolean expression (@foo || !@bar) && @zap.
                                     
        Beware that if you want to use several negative tags to exclude several tags
        you have to use logical AND: --tags ~@fixme --tags ~@buggy.

I think last two lines answer your question ;)

Regards, Oleg.



Cheers, 
Alex


--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Alexander Khozya

unread,
Apr 22, 2013, 4:46:58 AM4/22/13
to cu...@googlegroups.com
Oh, thank you! Missed point with OR

@CuriousAgilist

unread,
Apr 22, 2013, 6:24:35 AM4/22/13
to cu...@googlegroups.com
On Monday, April 22, 2013 3:58:20 AM UTC-4, Alexander Khozya wrote:
System: OS X 10.8.3, Cucumber: 1.2.1, Ruby: 1.8.7

Hi! I'm using calabash-cucumber and I need to exclude several tags from my test run?

Let's assume I have a feature with three tests tagged @iphone @ipad @ipod

> If I run my tests with key --tags ~@ipad it works correct - two tests are ran: @iphone, @ipod 
> If I run my tests like this: --tags ~@ipad,~@iphone - all three are ran: @ipad, @iphone, @ipod

There's a much simpler solution: think positive, say what you want vs. what you don't want. For instance, to exclude ipad and iphone tests specify --tags @ipod. It will run only the ipod tests.
Hope this helps,
Bob 

Anastasia

unread,
Nov 14, 2019, 6:47:17 AM11/14/19
to Cukes
Thank you a lot!

On Monday, April 22, 2013 at 10:04:44 AM UTC+2, Oleg Sukhodolsky wrote:

Cheers, 
Alex
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cu...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en

---
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 cu...@googlegroups.com.

Aslak Hellesøy

unread,
Nov 14, 2019, 7:07:23 AM11/14/19
to Cukes
Anastasia - you just replied to a 7 year old thread :-)
Reply all
Reply to author
Forward
0 new messages