10
votes

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.

3

3 Answers

10
votes

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.

1
votes

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.

0
votes

Each Scenario should end up becoming one MSTest. In ReSharper, I typically go into the Unit Test Explorer (Control+Alt+U), make sure the Group by is set to Projects and Namespaces, then navigate down to my Acceptance Test project, open up the namespace for my feature (I group feature files in directories to put them in matching namespaces), and expand the feature to see all of the individual tests/scenarios. Selecting just one of those and clicking the Run or Debug button should execute that one test.