There are many articles on the network about how to use SpecFlow, how to configure TFS to run tests, but there is not one that contains all aspects. In this article, I will tell you how to make running and editing SpecFlow scripts convenient for everyone.
Under the cut you will learn how to get:
- Running tests from TFS
- Automatic scripting link to test cases in TFS
- Always up-to-date content of test cases in TFS
- Ability to edit scripts directly in the version control system by testers

Background
BDD . - TFS, , SpecFlow โ TFS, -. .
:
- SpecFlow
- Azure DevOps Server (aka Team Foundation Server)
- SpecFlow TFS
1.
, . .

2.
โ Visual Studio Test


3.
, Visual Studio TFS -. , , , FeatureSync. โ feature , API TFS .
FeatureSync
namespace feature :
#language:en
@Namespace:Application.Autotests
Feature: Log to application
*namespace .dll -
TFS id :

@2124573 @posistive
Scenario: Successful authorization
Given I on authorization page
And I enter:
| Login | Password |
| user | pass |
When I press Login button
Then Browser redirect on Home page
FeatureSync:
FeatureSync.exe -f C:\FolderWithFeatures -s https://tfs.server.com/collection -t 6ppjfdysk-your-tfs-token-2d7sjwfbj7rzba
:

SpecFlow Automation


4. -
We create a test plan, add our automated cases to it, in the settings we select the assembly and release


5. Running tests
We select the necessary test in the test plan and run.

Conclusion
Advantages of this config:
- any tester can open the fetaure file in the web version control form, edit it and the changes will take effect immediately after assembly
- you can run tests at any time individually
- transparent test model - we always know what the test we launched does.