OR’ng, AND’g and NOT tags

After tagging scenarios, features for a while in your project, you might want to execute the scenarios based on your need at different points during the delivery cycle. Please read the previous section “Tag Scenarios” to get a context on this page. Let’s talk about some scenarios:

1) You are nearing beta and you have limited time. So you have to prioritize execution of test cases. You might want to execute only “@beta3” and “@fast” tests

2) You want to execute all scenarios in your project except “@parallel” because you realized that application is not handling race conditions well.

3) You want to execute all scenarios that are @fast or @parallel (In this case, lets say you already tagged some scenarios as @fast and some other scenarios as @parallel and you just want all of them to run)



Execute all scenarios except “@parallel”



Execute fast or parallel scenarios


Execute @beta3 and @fast scenarios


Lets say below is my feature file (This is the same feature file we used for Waits)


Running all features:

Let’s say we are executing all feature files on a project. It is as simple as right-click on the feature folder and Run


Case Negation:

If you ran with “~@parallel”, then all scenarios except the following will run


1) Scenario: Script Timeout

2) Scenario: Explicit wait block using exists


Case OR’ng:

If you ran with “@fast,@parallel”, then that are either parallel or fast will run

Case AND’ng:

If you ran with “–tags @fast –tags @beta3”, then both fast and beta3 will run. In the above case, there are no scenarios that match the criteria


Closing Thoughts:

As mentioned in previous page, tags are a powerful way to slice and dice tests