Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable a feature in specflow (Gherkin) without deleting the feature?

I have some SpecFlow features (using the Gherkin syntax) and I would like to temporarily disable the feature to prevent its tests from running?

Is there an attribute I can mark the feature with to do this? I'm guessing that something that works with Cucumber might also work with SpecFlow.

like image 950
Simon Keep Avatar asked Jun 03 '10 13:06

Simon Keep


People also ask

How do I ignore a feature file in SpecFlow?

Ignored Tests Just like with normal unit tests, you can also ignore SpecFlow tests. To do so, tag the feature or scenario with the @ignore tag.

What is the difference between background and scenario outline?

Use scenario outlines to group examples that share the same structure, and put common data in the scenario instead of the example tables. Use background sections to expose contextual information for examples that do not share the same structure.

How do you add multiple scenarios in SpecFlow feature file?

@Nir Multiple scenarios can be added by just specifying a new Scenario: tag. Scenario outline is detailed in the SpecFlow docs on their site. Without really understanding what it is you want to parameterise, I can't offer a code sample.

What is the extension of gherkin feature files?

All Gherkin files have the . feature file extension. They contain a single Feature definition for the system under test and are an executable test script.


2 Answers

You can mark the feature with the tag @ignore:

@ignore @web Scenario: Title should be matched When I perform a simple search on 'Domain' Then the book list should exactly contain book 'Domain Driven Design' 
like image 192
jbandi Avatar answered Sep 25 '22 15:09

jbandi


In the recent version of Specflow, you now also have to provide a reason with the tag, like so:

@ignore("reason for ignoring") 

EDIT: For some reason it break with spaces but this works:

@ignore("reason") 
like image 43
Xena Avatar answered Sep 22 '22 15:09

Xena