ignoring certain tags in cucumber JVM

2,742 views
Skip to first unread message

akanksha

unread,
Apr 9, 2012, 6:52:43 AM4/9/12
to Cukes
Hi All,

My feature file has around 10 Scenarios
from that i dont want to run 2 Scenarios which are marked as
@Manual

When i was using cukeforDuke
in the property file i used to give a tag ~@Manual and it used to
ignore all the scenarios with manual tag

The same is not working for cucumber JVM
Can you help me how to ignore certain scenarions in cucumber JVM

Thanks
Akanksha

aslak hellesoy

unread,
Apr 10, 2012, 5:29:24 AM4/10/12
to cu...@googlegroups.com

Using JUnit:

@RunWith(Cucumber.class)
@Cucumber.Options(tags="@Manual")
public class RunCukesTest {}

Using the CLI:

--tags @Manual

Aslak

> Thanks
> Akanksha
>
> --
> 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 http://groups.google.com/group/cukes?hl=en.
>

akanksha

unread,
Apr 12, 2012, 8:19:03 AM4/12/12
to Cukes
Hi Aslak

My feature file is as follows :
------------------------------------------------------------

@NewRelease
Feature: this is a test feature for this release

@Manual
Scenario1: Testing Scenario1
Given: I login as a Administrator
When i do something
Then It should be successful

Scenario2: Testing Scenario1
Given I login as a teacher
When i add a student
Then Then student should be added Successfully

Scenario3: Testing Scenario1
Given I login as a Student
When i Deliver a test
Then the score should be submitted



----------------------------------------------------------------

Now i have a prop file site_execution. prop

where i have defined
ExecuteTag=~@Manual , @NewRelease


In My build file i have mentioned the tags as
<arg value="--tags"/>
<arg value="${executeTags}"/>
Here Execute tags is read from site execution property file


When i execute, it does not ignore the scenario having a MANUAL tag.
Instead it runs the complete feature file

How can i Ignore the scenarios having Manual tag

On Apr 10, 2:29 pm, aslak hellesoy <aslak.helle...@gmail.com> wrote:

aslak hellesoy

unread,
Apr 12, 2012, 8:56:20 AM4/12/12
to cu...@googlegroups.com
On Thu, Apr 12, 2012 at 1:19 PM, akanksha <coolak...@gmail.com> wrote:
> Hi Aslak
>
> My feature file is as follows  :
> ------------------------------------------------------------
>
> @NewRelease
> Feature: this is a test feature for this release
>
> @Manual
> Scenario1: Testing Scenario1
> Given: I login as a Administrator
> When i do something
> Then  It should be successful
>
> Scenario2: Testing Scenario1
> Given I login as a teacher
> When i add a student
> Then  Then student should be added Successfully
>
> Scenario3: Testing Scenario1
> Given I login as a Student
> When i Deliver a test
> Then the score should be submitted
>
>
>
> ----------------------------------------------------------------
>
> Now i have a prop file site_execution. prop
>
> where i have defined
> ExecuteTag=~@Manual , @NewRelease
>

That tag expression is equivalent to: NOT @Manual OR @NewRelease

>
> In My build file i have mentioned the tags as
>        <arg value="--tags"/>
>                <arg value="${executeTags}"/>
> Here Execute tags is read from site execution property file
>

Typo? executeTags != ExecuteTag

>
> When i execute, it does not ignore the scenario having a MANUAL tag.

Typo? MANUAL != Manual

> Instead it runs the complete feature file
>
> How can i Ignore the scenarios having Manual tag
>

Instead of: NOT @Manual OR @NewRelease
You want: NOT @Manual AND @NewRelease


This translates to: --tags ~@Manual --tags @NewRelease

See https://github.com/cucumber/cucumber/wiki/Tags for an explanation

I realise this isn't the most intuitive in the world. I'm pondering
whether we should add a mini-language so you can do:

--tags "NOT @Manual AND @NewRelease"

Tag expression logic lives in the gherkin library, so if anyone feels
like adding this it should go there...

Aslak

Reply all
Reply to author
Forward
0 new messages