SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

En vedette

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
 

En vedette (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
 

Dernier

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Dernier (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

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