- SpecFlow Tutorial
- SpecFlow - Home
- SpecFlow - Introduction
- Test Driven Development
- Behaviour Driven Development
- SpecFlow - Visual Studio Installation
- Visual Studio Extension Installation
- SpecFlow - Project Set Up
- Other Project Dependencies
- SpecFlow - Runner Activation
- SpecFlow - HTML Reports
- SpecFlow - Binding Test Steps
- SpecFlow - Creating First Test
- Configure Selenium Webdriver
- SpecFlow - Gherkin
- SpecFlow - Gherkin Keywords
- SpecFlow - Feature File
- SpecFlow - Step Definition File
- SpecFlow - Hooks
- SpecFlow - Background Illustration
- Data Driven Testing with Examples
- Data Driven Testing without Examples
- Table conversion to Data Table
- Table conversion to Dictionary
- Table with CreateInstance
- SpecFlow - Table with CreateSet
- SpecFlow Useful Resources
- SpecFlow - Quick Guide
- SpecFlow - Useful Resources
- SpecFlow - Discussion
SpecFlow - Data Driven Testing without Examples
We can perform data driven testing without the help of keyword Examples. This can be done by passing the data directly to the steps within the Feature File enclosed in (''). It will then be provided as an input to the Step Definition File.
Let us verify a module, for which the below steps need to be executed −
- User launches URL
- URL should open
Step 1: Create a Feature File
The details of how to create a Feature File is discussed in detail in the Chapter − Feature File.
Feature: Launching application Scenario: Launch URL Given User hits URL 'https://www.tutorialspoint.com/index.htm' Then URL should be launched
Step 2: Create a Step Definition File
The details of how to create a Step Definition File is discussed in detail in the Chapter – Step Definition File.
using System; using TechTalk.SpecFlow; namespace SpecFlowProject1.Features{ [Binding] public class LaunchingApplicationSteps{ [Given(@"User hits URL '(.*)'")] public void GivenUserHitsURL(string url){ Console.WriteLine(url); } [Then(@"URL should be launched")] public void ThenURLShouldBeLaunched(){ Console.WriteLine("URL should be launched"); } } }
Step 3: Execution & Results
Select Launching Application Feature, then click on Run All Tests in View.
Select Launch URL Scenario, then click on Open additional output for this result link.
In the above output, the url (https://www.tutorialspoint.com/index.htm) is obtained which is passed directly from the Feature File within the Given step.