Specflow Tutorial
Introduction to SpecFlow Installation of SpecFlowWriting first SpecFlow test in Visual Studio Writing step definitions for a SpecFlow feature file Executing SpecFlow scenarios and feature files Using SpecFlow runner to execute the feature files Using tags in SpecFlow Passing parameters to steps Data table in SpecFlow Scenario Background Scenario outline Hooks in SpecFlow Executing Selenium tests with SpecFlow Executing the failed test multiple times Sharing selenium Webdriver instance in SpecFlow Writing to SpecFlow HTML reportsSpecflow Tags
We can use tags in SpecFlow to group the scenarios. Consider below feature file.
Feature: Bank Feature File
@sanity
Scenario: ATM money withdrawal scenario
Given I have $1000 in my account
When I withdraw $200 from ATM
Then my balance should be $800
@sanity
Scenario: ATM money - Enter Pin
When I enter PIN as 4141
Then I should see the Transaction options
@regression
Scenario: ATM - Check Balance scenario
Given I have $1000 in my account
When I view the balance
Then my balance should be $1000
In this feature file, we have tagged 2 scenarios with tag – sanity and one scenario is tagged with regression. After building the solution, test explorer shows these scenarios under sanity and regression tags. This is how we can group the scenarios in SpecFlow. To execute the scenarios tagged with specific name, we can just right click on the tag name in the test explorer and click on run selected tests.
Web development and Automation testing
solutions delivered!!