Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a single Specflow scenario in Resharper

I am using Specflow (http://specflow.org/) to write some integration tests and I would like to run a single Scenario. Is there any way to run a single scenario with Resharper 6? BTW I configured specflow to use MSTest.

My Specflow test looks like:

Feature: Customer management

Scenario: Add a new Customer into system
    Given the User has entered the customer with the following data
    | name  | last_name | birthday   |
    | Peter | Stein     | 12.09.1955 |
    When the User has pressed the Save Button
    Then the following customer should be stored in the data base
    | name  | last_name | birthday   |
    | Peter | Steim    | 12.09.1955 |

Scenario: Second scenario.....

Scenario: Third scenario.....

I want to run only the first scenario.

like image 660
Diego Avatar asked Feb 27 '12 18:02

Diego


People also ask

How do I run a specific scenario in SpecFlow?

In order to execute your SpecFlow tests, you need to define the tests as Gherkin feature files, bind the steps defined in your feature files to your code, and configure a unit test provider to execute the tests. SpecFlow generates executable unit tests from your Gherkin files.

How do I run a SpecFlow feature file in Visual Studio?

when right-clicking on a feature file and selecting Run Custom Tool , make sure the SpecFlow extension is enabled. To enable the extension in Visual Studio, select Tools | Extensions and Updates…, select the “SpecFlow for Visual Studio” extension, then select Enable.

What are the two files required to execute a SpecFlow test scenario?

Files needed for test SpecFlow tests typically consist of two files, your Feature file and your Step Definitions. Your feature file is where you will be coding out your scenarios, and your step definitions file is where you define how your test behaves.


2 Answers

If you are running with ReSharper as I am I just open the Feature file the right-click anywhere within a Scenario and select "Run Specflow Scenarios" from the pop-up menu. It runs just the one scenario you are in.

Please note, I am using ReSharper to run the tests.

like image 102
Keith Barrows Avatar answered Oct 21 '22 13:10

Keith Barrows


what i do is pop open the generated c# file and find the generated test there and use my keyboard shortcuts i have set up for the resharper test runner to execute the specs (and could use the green/yellow balls with the mouse too). it's less than ideal and i agree it would be awesome if you could just execute from the feature file. i haven't found anything like that out there. would be a worthwhile project to try to figure out a way to make that happen with a plugin. not sure what that would take.

like image 33
Dave Rael Avatar answered Oct 21 '22 14:10

Dave Rael