SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Learn how SpecFlow enables you to do TDD
with friction-free plain-English executable tests.
Larry Apke
Agile Expert
www.agile-doctor.com
larry@agile-doctor.com
• Who are You?
• Who I am and What I Believe
• What is BDD?
• SpecFlow Overview
• Visual Studio 12 SpecFlow Installation
• Interacting with Code!
Who are you?
•How many .net programmers?
•How many using Visual Studio 2012?
•How many familiar with TDD?
•How many familiar with BDD?
•How many using/used SpecFlow?
Who I am:
•A Certified Scrum Master and Certified Scrum Professional
with over 5 years experience in Agile development.
•A former Director of Software Development, Manager of
Software Development, Project Manager, etc.
Who I am not:
•A .Net Programmer
What I believe:
•If you are a programmer and have not acquainted yourself
with and mastered BDD/TDD then you are no longer a true
craftsman.
“TDD is probably the single most important practice
discovered in the last 10 years. “ - Robert Martin
Founder, CEO and President Object Mentor Inc.

•Without automated executable specifications (like those
created through BDD), it is nearly impossible to be truly
Agile.
•Over the next five years BDD/TDD will become THE
standard for software development.
• BDD is a software development process based on test-

driven development (TDD). Sometimes described as
“TDD done right.”
• Developed by Dan North as a response to the issues
encountered teaching test-driven development.
• “BDD is a second-generation, outside–in, pull-based,
multiple-stakeholder, multiple-scale, highautomation, agile methodology. It describes a cycle of
interactions with well-defined outputs, resulting in
the delivery of working, tested software that matters.”
– Dan North
• BDD utilizes Ubiquitous Business Language (UBL),

which is composed of plain English, to create
executable specifications.
• Because of UBL, BDD is concerned with the
communication between business needs and
developers.
• BDD allows for frameworks like SpecFlow to automate
the running of the executable specifications by using
Scenarios written using the Gherkin language (Given,
When, Then) - called Gherkin because of Cucumber
(a Ruby BDD Framework that inspired SpecFlow).
Input

Feature File

Output

SpecFlow

Unit Test File

Step Definitions File
SpecFlow

Unit Test File

Test Results File

Step Definitions File

Test Results Report

Class File
• Easy to install with Visual Studio Gallery
• Nearly impossible to get working under Visual

Studio Express but you can try http://watirmelon.com/2011/02/18/c-sharp-atdd-ona-shoestring/
• Make sure that you add SpecFlow and Nunit to your
Windows path
• If you use Nunit you will need something to run the
tests – like Resharper– but you can create a batch file
that will run Nunit and add it to your Tools menu
• Batch File Copy and Paste:

@echo off
nunit-console %1
specflow.exe nunitexecutionreport %2
/xmlTestResult:%3
if NOT %errorlevel% == 0 (
echo "Error generating report - %errorlevel%"
GOTO :exit
)
if %errorlevel% ==0 TestResult.html
:exit
• External Tools Setup:

Title – Run SpecFlow
Command – C:PATH TO FILEnameofbatfile.bat
Arguments - $(TargetName)$(TargetExt)
$(ProjectDir)$(ProjectFileName)
$(BinDir)TestResult.xml
Initial Directory - $(BinDir)
Check Use Output Window
• Setup Project

• Setup the test engine for your project through NuGet
•

•
•
•

- PM> Install-Package SpecFlow.Nunit
Create Feature File
Create Step Definitions
Run Test(s)
Write and Refactor

Weitere ähnliche Inhalte

Andere mochten auch

Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkSteve Zhang
 
Cross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowCross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowChristian Hassa
 
REST API testing with SpecFlow
REST API testing with SpecFlowREST API testing with SpecFlow
REST API testing with SpecFlowAiste Stikliute
 
Introduction to the Improvement Kata
Introduction to the Improvement KataIntroduction to the Improvement Kata
Introduction to the Improvement KataMike Rother
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with CucumberBen Mabey
 

Andere mochten auch (7)

Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
Cross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlowCross mobile testautomation mit Xamarin & SpecFlow
Cross mobile testautomation mit Xamarin & SpecFlow
 
API Testing
API TestingAPI Testing
API Testing
 
REST API testing with SpecFlow
REST API testing with SpecFlowREST API testing with SpecFlow
REST API testing with SpecFlow
 
Introduction to the Improvement Kata
Introduction to the Improvement KataIntroduction to the Improvement Kata
Introduction to the Improvement Kata
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
The Executives Guide
The Executives GuideThe Executives Guide
The Executives Guide
 

Kürzlich hochgeladen

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Kürzlich hochgeladen (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

BDD with Visual Studio 2012 and SpecFlow

  • 1. Learn how SpecFlow enables you to do TDD with friction-free plain-English executable tests. Larry Apke Agile Expert www.agile-doctor.com larry@agile-doctor.com
  • 2. • Who are You? • Who I am and What I Believe • What is BDD? • SpecFlow Overview • Visual Studio 12 SpecFlow Installation • Interacting with Code!
  • 3. Who are you? •How many .net programmers? •How many using Visual Studio 2012? •How many familiar with TDD? •How many familiar with BDD? •How many using/used SpecFlow?
  • 4. Who I am: •A Certified Scrum Master and Certified Scrum Professional with over 5 years experience in Agile development. •A former Director of Software Development, Manager of Software Development, Project Manager, etc. Who I am not: •A .Net Programmer
  • 5. What I believe: •If you are a programmer and have not acquainted yourself with and mastered BDD/TDD then you are no longer a true craftsman. “TDD is probably the single most important practice discovered in the last 10 years. “ - Robert Martin Founder, CEO and President Object Mentor Inc. •Without automated executable specifications (like those created through BDD), it is nearly impossible to be truly Agile. •Over the next five years BDD/TDD will become THE standard for software development.
  • 6. • BDD is a software development process based on test- driven development (TDD). Sometimes described as “TDD done right.” • Developed by Dan North as a response to the issues encountered teaching test-driven development. • “BDD is a second-generation, outside–in, pull-based, multiple-stakeholder, multiple-scale, highautomation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.” – Dan North
  • 7. • BDD utilizes Ubiquitous Business Language (UBL), which is composed of plain English, to create executable specifications. • Because of UBL, BDD is concerned with the communication between business needs and developers. • BDD allows for frameworks like SpecFlow to automate the running of the executable specifications by using Scenarios written using the Gherkin language (Given, When, Then) - called Gherkin because of Cucumber (a Ruby BDD Framework that inspired SpecFlow).
  • 8. Input Feature File Output SpecFlow Unit Test File Step Definitions File
  • 9. SpecFlow Unit Test File Test Results File Step Definitions File Test Results Report Class File
  • 10. • Easy to install with Visual Studio Gallery • Nearly impossible to get working under Visual Studio Express but you can try http://watirmelon.com/2011/02/18/c-sharp-atdd-ona-shoestring/ • Make sure that you add SpecFlow and Nunit to your Windows path • If you use Nunit you will need something to run the tests – like Resharper– but you can create a batch file that will run Nunit and add it to your Tools menu
  • 11. • Batch File Copy and Paste: @echo off nunit-console %1 specflow.exe nunitexecutionreport %2 /xmlTestResult:%3 if NOT %errorlevel% == 0 ( echo "Error generating report - %errorlevel%" GOTO :exit ) if %errorlevel% ==0 TestResult.html :exit
  • 12. • External Tools Setup: Title – Run SpecFlow Command – C:PATH TO FILEnameofbatfile.bat Arguments - $(TargetName)$(TargetExt) $(ProjectDir)$(ProjectFileName) $(BinDir)TestResult.xml Initial Directory - $(BinDir) Check Use Output Window
  • 13. • Setup Project • Setup the test engine for your project through NuGet • • • • - PM> Install-Package SpecFlow.Nunit Create Feature File Create Step Definitions Run Test(s) Write and Refactor