SlideShare a Scribd company logo
Introduction to
Behaviour Driven



                   nickmulder
Behaviour Driven Development aka BDD
Behaviour Driven Development aka BDD


   http://blog.DanNorth.net/introducing-bdd/
The BDD Language
The BDD Language
The BDD Language
Before & After
Dan North says BDD is



“
    BDD is a second-generation, outside-in, pull-based,
    multiple-stakeholder, multiple-scale, high-
    automation, agile methodology.

    It describes a cycle of interactions with well-defined




                       ”
    outputs, resulting in the delivery of working, tested
    software that matters.
                                                Dan North
                                                November 2009
WTF
I thought BDD was just TDD but with words like context and
                         should?
BDD in a nutshell

“
BDD focuses on obtaining a clear understanding of desired
software behaviour through discussion with stakeholders.




                         ”
It extends TDD by writing test cases in a natural language
that non-programmers can read.
                                                  Wikipedia
                                          On Behaviour Driven Development
• One more time... BDD is
  Establishing the goals of different stakeholders required for a vision to be
  implemented

• Drawing out features which will achieve those goals using feature injection
• Involving stakeholders in the implementation process through outside-in software
  development

• Using examples to describe the behaviour of the application, or of units of code
• Automating those examples to provide quick feedback and regression testing
• Using 'should' and allow the software's functionality to be questioned
  responsibility
                 when describing the behaviour of software to help clarify


• Using 'ensure' when describing responsibilities from side-effects of other elements
  outcomes in the scope of the code in question
                                                   of software to differentiate

  of code.

• Usingwritten to stand-in for collaborating modules of code which have not yet
  been
       mocks
                                                                                Wikipedia
                                                                   On Behaviour Driven Development
• One more time... BDD is
  Establishing the goals of different stakeholders required for a vision to be
  implemented

• Drawing out features which will achieve those goals using feature injection
• Involving stakeholders in the implementation process through outside-in software
  development

• Using examples to describe the behaviour of the application, or of units of code
• Automating those examples to provide quick feedback and regression testing
• Using 'should' and allow the software's functionality to be questioned
  responsibility
                 when describing the behaviour of software to help clarify


• Using 'ensure' when describing responsibilities from side-effects of other elements
  outcomes in the scope of the code in question
                                                   of software to differentiate

  of code.

• Usingwritten to stand-in for collaborating modules of code which have not yet
  been
       mocks
                                                                                Wikipedia
                                                                   On Behaviour Driven Development
What are my Choices?
What are my Choices?



      Shoulda & RSpec
Getting started with RSpec
Getting started with RSpec



        rails new my_app -T
Gemfile
Gemfile
bundle install

script/rails generate rspec:install
bundle install

script/rails generate rspec:install




rake spec
bundle install

script/rails generate rspec:install




rake spec
  No examples matching ./spec/**/*_spec.rb could be found
Bonus Points
gem install autotest autotest-growl colored
Bonus Points
          gem install autotest autotest-growl colored


# ~/.autotest
require 'autotest/growl'

# ~/.rspec
--color
--format nested
spec/spec_helper.rb
spec/spec_helper.rb
My First Spec
Run the spec
rake spec
Going Green
Going Green
Going Green
RSpec Expectations
RSpec Expectations
RSpec Expectations
RSpec Expectations
RSpec Expectations
RSpec Matchers
RSpec Matchers
RSpec Matchers
RSpec Matchers
Context
Context
Context
Context
Context
Implementing the
   Examples
Implementing the
   Examples
BDD Style Switch
BDD Style Switch
BDD Style Switch
Going Green
Going Green
Spec out our Switch
Spec out our Switch
Spec out our Switch
Spec out our Switch
Spec out our Switch
Spec out our Switch
Spec out our Switch
Red
Red
Green
Green Red
Green Red
Green?
Green!
Red
Green
Red Green
Red Green
Red Green
Red Green
Red Green
Time to Refactor
Time to Refactor
Time to Refactor
Toggle
Toggle
Toggle
Toggle
nickmulder
nickmulder




                        [Links]
       http://blog.dannorth.net/introducing-bdd/
http://en.wikipedia.org/wiki/Behavior_Driven_Development
                   http://rspec.info/

More Related Content

What's hot

Help! My Legacy Application is Unmaintainable!
Help! My Legacy Application is Unmaintainable!Help! My Legacy Application is Unmaintainable!
Help! My Legacy Application is Unmaintainable!
John Ferguson Smart Limited
 
Vertical vs Horizontal Software Architecture
Vertical vs Horizontal Software ArchitectureVertical vs Horizontal Software Architecture
Vertical vs Horizontal Software Architecture
Christian Hujer
 
Getting Comfortable with BDD
Getting Comfortable with BDDGetting Comfortable with BDD
Getting Comfortable with BDD
Alex Sharp
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
Iosif Itkin
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & Jasmine
Remus Langu
 
Behavior driven development (bdd)
Behavior driven development (bdd)Behavior driven development (bdd)
Behavior driven development (bdd)
Rohit Bisht
 
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
Agile Testing Alliance
 
The Smells Of Bad Design
The Smells Of Bad DesignThe Smells Of Bad Design
The Smells Of Bad Designguest446c0
 
Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd Sakares Saengkaew
 
TDD and BDD in Java 8 - what's in it for me?
TDD and BDD in Java 8 - what's in it for me?TDD and BDD in Java 8 - what's in it for me?
TDD and BDD in Java 8 - what's in it for me?
John Ferguson Smart Limited
 
BDD: There's more to it than you think
BDD: There's more to it than you thinkBDD: There's more to it than you think
BDD: There's more to it than you think
John Ferguson Smart Limited
 
BDD with JBehave
BDD with JBehaveBDD with JBehave
BDD with JBehave
Sascha Rodekamp
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in Practice
Ganesh Samarthyam
 
Scrum + bdd + ddd
Scrum + bdd + dddScrum + bdd + ddd
Scrum + bdd + ddd
Helder De Oliveira
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
Robin O'Brien
 
Caring about Code Quality
Caring about Code QualityCaring about Code Quality
Caring about Code Quality
Saltmarch Media
 
So What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With TestingSo What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With Testing
sjmarsh
 
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
Introduction to Behaviour Driven Development (BDD) and Cucumber with JavaIntroduction to Behaviour Driven Development (BDD) and Cucumber with Java
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
Jawad Khan
 
Its testing-jim-but-not-as-we-know-it-devoxx
Its testing-jim-but-not-as-we-know-it-devoxxIts testing-jim-but-not-as-we-know-it-devoxx
Its testing-jim-but-not-as-we-know-it-devoxx
John Ferguson Smart Limited
 
How to successfully execute fixed price agile projects
How to successfully execute fixed price agile projectsHow to successfully execute fixed price agile projects
How to successfully execute fixed price agile projects
Katy Slemon
 

What's hot (20)

Help! My Legacy Application is Unmaintainable!
Help! My Legacy Application is Unmaintainable!Help! My Legacy Application is Unmaintainable!
Help! My Legacy Application is Unmaintainable!
 
Vertical vs Horizontal Software Architecture
Vertical vs Horizontal Software ArchitectureVertical vs Horizontal Software Architecture
Vertical vs Horizontal Software Architecture
 
Getting Comfortable with BDD
Getting Comfortable with BDDGetting Comfortable with BDD
Getting Comfortable with BDD
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and Cons
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & Jasmine
 
Behavior driven development (bdd)
Behavior driven development (bdd)Behavior driven development (bdd)
Behavior driven development (bdd)
 
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...
 
The Smells Of Bad Design
The Smells Of Bad DesignThe Smells Of Bad Design
The Smells Of Bad Design
 
Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd Practiced agile developer with tdd & bdd
Practiced agile developer with tdd & bdd
 
TDD and BDD in Java 8 - what's in it for me?
TDD and BDD in Java 8 - what's in it for me?TDD and BDD in Java 8 - what's in it for me?
TDD and BDD in Java 8 - what's in it for me?
 
BDD: There's more to it than you think
BDD: There's more to it than you thinkBDD: There's more to it than you think
BDD: There's more to it than you think
 
BDD with JBehave
BDD with JBehaveBDD with JBehave
BDD with JBehave
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in Practice
 
Scrum + bdd + ddd
Scrum + bdd + dddScrum + bdd + ddd
Scrum + bdd + ddd
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
 
Caring about Code Quality
Caring about Code QualityCaring about Code Quality
Caring about Code Quality
 
So What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With TestingSo What Do Cucumbers Have To Do With Testing
So What Do Cucumbers Have To Do With Testing
 
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
Introduction to Behaviour Driven Development (BDD) and Cucumber with JavaIntroduction to Behaviour Driven Development (BDD) and Cucumber with Java
Introduction to Behaviour Driven Development (BDD) and Cucumber with Java
 
Its testing-jim-but-not-as-we-know-it-devoxx
Its testing-jim-but-not-as-we-know-it-devoxxIts testing-jim-but-not-as-we-know-it-devoxx
Its testing-jim-but-not-as-we-know-it-devoxx
 
How to successfully execute fixed price agile projects
How to successfully execute fixed price agile projectsHow to successfully execute fixed price agile projects
How to successfully execute fixed price agile projects
 

Viewers also liked

ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง
ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง
ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง pyopyo
 
Disney Is a Drag
Disney Is a DragDisney Is a Drag
Disney Is a Drag
dezignjk
 
Illustration portfolio
Illustration portfolioIllustration portfolio
Illustration portfolio
dezignjk
 
Prosumer Report Health Wellness
Prosumer Report Health WellnessProsumer Report Health Wellness
Prosumer Report Health WellnessMona Herrera
 

Viewers also liked (8)

ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง
ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง
ประกาศสัมภาษณ์ สหวิทยาการ ลำปาง
 
Music for the devil
Music for the devilMusic for the devil
Music for the devil
 
Healthy people
Healthy peopleHealthy people
Healthy people
 
Disney Is a Drag
Disney Is a DragDisney Is a Drag
Disney Is a Drag
 
Illustration portfolio
Illustration portfolioIllustration portfolio
Illustration portfolio
 
The bible story
The bible storyThe bible story
The bible story
 
Prosumer Report Health Wellness
Prosumer Report Health WellnessProsumer Report Health Wellness
Prosumer Report Health Wellness
 
Prezi
PreziPrezi
Prezi
 

Similar to TorontoRb Intro to BDD

BDD presentation
BDD presentationBDD presentation
BDD presentation
temebele
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
Adam Englander
 
DevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDays Jakarta Igites
DevOpsDays Jakarta Igites
DevOpsDaysJKT
 
Spec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSpec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlow
Sarah Dutkiewicz
 
CucumberSeleniumWD
CucumberSeleniumWDCucumberSeleniumWD
CucumberSeleniumWDVikas Sarin
 
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with CucumberIntroducing BDD and TDD with Cucumber
Introducing BDD and TDD with Cucumber
Knoldus Inc.
 
BDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talkBDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talkAliaksandr Ikhelis
 
Enter the mind of an Agile Developer
Enter the mind of an Agile DeveloperEnter the mind of an Agile Developer
Enter the mind of an Agile Developer
BSGAfrica
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
Fwdays
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
Alexandr Savchenko
 
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh EastmanBehavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
QA or the Highway
 
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...
Katy Slemon
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Synerzip
 
Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD
Gervais Johnson, Advisor
 
Rhapsody reverseengineering
Rhapsody reverseengineeringRhapsody reverseengineering
Rhapsody reverseengineering
Scott Althouse
 
Discovery Life Project Portfolio
Discovery Life Project PortfolioDiscovery Life Project Portfolio
Discovery Life Project PortfolioJaco Koekemoer
 
仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か
Kohei Otsuka
 
TDD and BDD in Sky Deutschland
TDD and BDD in Sky DeutschlandTDD and BDD in Sky Deutschland
TDD and BDD in Sky Deutschland
Murphy Meng
 
A study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven DevelopmentA study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven Development
Carlos Solís
 

Similar to TorontoRb Intro to BDD (20)

BDD presentation
BDD presentationBDD presentation
BDD presentation
 
Bdd with m spec
Bdd with m specBdd with m spec
Bdd with m spec
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
 
DevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDays Jakarta Igites
DevOpsDays Jakarta Igites
 
Spec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlowSpec(ing) Out Your Workflow with SpecFlow
Spec(ing) Out Your Workflow with SpecFlow
 
CucumberSeleniumWD
CucumberSeleniumWDCucumberSeleniumWD
CucumberSeleniumWD
 
Introducing BDD and TDD with Cucumber
Introducing BDD and TDD with CucumberIntroducing BDD and TDD with Cucumber
Introducing BDD and TDD with Cucumber
 
BDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talkBDD communication bridges - Expedia TED talk
BDD communication bridges - Expedia TED talk
 
Enter the mind of an Agile Developer
Enter the mind of an Agile DeveloperEnter the mind of an Agile Developer
Enter the mind of an Agile Developer
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
 
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh EastmanBehavior Driven Development—A Guide to Agile Practices by Josh Eastman
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
 
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...
 
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Building In Quality: The Beauty Of Behavior Driven Development (BDD)
Building In Quality: The Beauty Of Behavior Driven Development (BDD)
 
Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD
 
Rhapsody reverseengineering
Rhapsody reverseengineeringRhapsody reverseengineering
Rhapsody reverseengineering
 
Discovery Life Project Portfolio
Discovery Life Project PortfolioDiscovery Life Project Portfolio
Discovery Life Project Portfolio
 
仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か仕様決定、部品化、ディレクションがなぜ重要か
仕様決定、部品化、ディレクションがなぜ重要か
 
TDD and BDD in Sky Deutschland
TDD and BDD in Sky DeutschlandTDD and BDD in Sky Deutschland
TDD and BDD in Sky Deutschland
 
A study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven DevelopmentA study of the characteristics of Behaviour Driven Development
A study of the characteristics of Behaviour Driven Development
 

Recently uploaded

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 

Recently uploaded (20)

DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 

TorontoRb Intro to BDD

Editor's Notes

  1. Introduce yourself My name is... I am the Senior Software Architect at NuLayer. Tonight I am going to give you a brief introduction to Behaviour Driven Development.
  2. - first heard about BDD about 3 years ago (on and off) Dan North has a great article [Click for article] - first published in (translated into 2 other languages) - a must read if you are interested in BDD - Dan has been writing/talking about BDD for a long while before that. - he was - Applying agile practices like TDD to numerous projects - He kept hitting the same stumbling block He running into the same problem; As he says it “Programmers wanted to know where to start, what to test and what not to test, how much to test in one go, what to call their tests, and how to understand why a test fails.” The beginning of BDD was when Dan decided to - changed the language they were using.
  3. We start with a dialog between you and your client; You ask a simple question like [Read Question] In TDD we might start with a test name like “account_init_test” we write things using natural language “First we say what we are describing” “Second we state our expectations through examples” we could write it like this; [Click] Describe; Rspec gives us options - we could also write it like this; [Click]
  4. We start with a dialog between you and your client; You ask a simple question like [Read Question] In TDD we might start with a test name like “account_init_test” we write things using natural language “First we say what we are describing” “Second we state our expectations through examples” we could write it like this; [Click] Describe; Rspec gives us options - we could also write it like this; [Click]
  5. We start with a dialog between you and your client; You ask a simple question like [Read Question] In TDD we might start with a test name like “account_init_test” we write things using natural language “First we say what we are describing” “Second we state our expectations through examples” we could write it like this; [Click] Describe; Rspec gives us options - we could also write it like this; [Click]
  6. Here is what that example might look like. - Notice the before and after blocks to setup and clean up for us. We also have some code in our example - Its actually pretty readable - notice the .should method; - we call this an expectation. - as the example reads; we expect it to be empty many decisions have already been made It might have been simpler to forgo the Money.new and just simply check that the starting balance was 0... But... Its all in that little $. The example called for 0 dollars, not a balance of 0 ... Dan was quoted as describing BDD as... [Next Slide]
  7. I first though of BDD as: - TDD with some special language - to get your head in the right place - TDD is primarily concerned with unit testing. - Its all about Red/Green; - red is a failing test, green is a passing test - The process (write, watch fail, min code to make it pass, watch it go green) - The problem with TDD - Where to start - BDD has this Red/Green push as well - actually more of a green, yellow, red, yellow, green thing... Back to what BDD is... [Next slide]
  8. Wikipedia tells us that... “BDD focuses...” - rely on testing (broken or working) BDD suggests we use natural language - Doing this we can; - Focus on why the code should be written - And avoid focusing on the technical details. A nice side effect - tests become readable - not just for developers either. - everybody on the team has a shot at reading the tests
  9. BDD is alot more then just special language on top of TDD. - gives us a clear path through the entire development process. [click to hide] Today we are only going to focus on a very small portion of BDD. Today we are going to learn some of the BDD language and use it as a TDD/test_unit replacement. Getting started like this: - easy to learn the language - to get your head in the right place
  10. BDD is alot more then just special language on top of TDD. - gives us a clear path through the entire development process. [click to hide] Today we are only going to focus on a very small portion of BDD. Today we are going to learn some of the BDD language and use it as a TDD/test_unit replacement. Getting started like this: - easy to learn the language - to get your head in the right place
  11. There are a few good options out there. Two of the more popular ones are Shoulda and RSpec. Shoulda is an extension of Test::Unit and works great on an existing project RSpec is a installs extra directories and scripts into your rails project.
  12. create sandbox app to play around with.
  13. 20 seconds on Gemfile; [Click to hide all but rspec lines]
  14. 20 seconds on Gemfile; [Click to hide all but rspec lines]
  15. Then you do a bundle install run the generate script from rspec_rails assuming all went well [Click] running rake spec should yield [Click] almost nothing
  16. Then you do a bundle install run the generate script from rspec_rails assuming all went well [Click] running rake spec should yield [Click] almost nothing
  17. [Click for tweaks to home directory]
  18. 5 seconds on the helper; [click to hide standard stuff]
  19. 5 seconds on the helper; [click to hide standard stuff]
  20. Here is a simple spec. In a rails project an easy place to stash this would be spec/models/my_first_spec.rb Notice the language: - describe (what is being described) - what is the requirement (N/A) - what is our expectation (it should work)
  21. Highlight the nice structure; - .rspec file makes things pretty ‘--format nested’ Highlight the summary line; 1 example, 1 pending
  22. difference between pending example vs example - is a block [click to show block] Even though the block is empty rspec will still count it as a passing example. [Click] Now that we have a working example... lets get some expectations.
  23. difference between pending example vs example - is a block [click to show block] Even though the block is empty rspec will still count it as a passing example. [Click] Now that we have a working example... lets get some expectations.
  24. difference between pending example vs example - is a block [click to show block] Even though the block is empty rspec will still count it as a passing example. [Click] Now that we have a working example... lets get some expectations.
  25. Rspec Expectations - Should - should not Back to “our first spec” example [Click to show code] Expectations are: - the first one which just worked - and a new one which does something [Click to show should] Example Should [Click to show should_not] Example should_not [Click to show sample output] Here is the output after running the specs
  26. Rspec Expectations - Should - should not Back to “our first spec” example [Click to show code] Expectations are: - the first one which just worked - and a new one which does something [Click to show should] Example Should [Click to show should_not] Example should_not [Click to show sample output] Here is the output after running the specs
  27. Rspec Expectations - Should - should not Back to “our first spec” example [Click to show code] Expectations are: - the first one which just worked - and a new one which does something [Click to show should] Example Should [Click to show should_not] Example should_not [Click to show sample output] Here is the output after running the specs
  28. Rspec Expectations - Should - should not Back to “our first spec” example [Click to show code] Expectations are: - the first one which just worked - and a new one which does something [Click to show should] Example Should [Click to show should_not] Example should_not [Click to show sample output] Here is the output after running the specs
  29. Describe the matches .. Lets try some of these out.
  30. Describe the matches .. Lets try some of these out.
  31. Describe the matches .. Lets try some of these out.
  32. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  33. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  34. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  35. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  36. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  37. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  38. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  39. Breaking examples down inside of contexts... [Click to focus on new context] we are saying that these examples should - demo the eql matcher - demo the true/false matcher ... Lets see this run [Click to show output] [Click to focus on nested output] [Click to focus on pending summary]
  40. Walk through examples; - eql matcher - true/false matcher .... and running them we get [Click to show green] ---- [Intro to next slide] Lets build a switch bdd style if I were to: - describe the switch to a client - I would say something like a switch should: - turn on/off (toggle - know if its on - know if its off
  41. Lets start with a spec; /spec/models/switch_spec.rb and if we run it [Click] Bah!... not good. Oh wait. [Click]
  42. Lets start with a spec; /spec/models/switch_spec.rb and if we run it [Click] Bah!... not good. Oh wait. [Click]
  43. We add the model to the rails project and running the specs [Click]
  44. Lets spec out our switch DISCLAIMER - I wrote this example before wrote the intro to this switch example. - I did it wrong. - Had i thought about it by describing it to a client - I would not have written these first two examples So in the order I thought them up: [Click] and describe. And running them [Click]
  45. Lets spec out our switch DISCLAIMER - I wrote this example before wrote the intro to this switch example. - I did it wrong. - Had i thought about it by describing it to a client - I would not have written these first two examples So in the order I thought them up: [Click] and describe. And running them [Click]
  46. Lets spec out our switch DISCLAIMER - I wrote this example before wrote the intro to this switch example. - I did it wrong. - Had i thought about it by describing it to a client - I would not have written these first two examples So in the order I thought them up: [Click] and describe. And running them [Click]
  47. Lets spec out our switch DISCLAIMER - I wrote this example before wrote the intro to this switch example. - I did it wrong. - Had i thought about it by describing it to a client - I would not have written these first two examples So in the order I thought them up: [Click] and describe. And running them [Click]
  48. Lets spec out our switch DISCLAIMER - I wrote this example before wrote the intro to this switch example. - I did it wrong. - Had i thought about it by describing it to a client - I would not have written these first two examples So in the order I thought them up: [Click] and describe. And running them [Click]
  49. Lets spec out our switch DISCLAIMER - I wrote this example before wrote the intro to this switch example. - I did it wrong. - Had i thought about it by describing it to a client - I would not have written these first two examples So in the order I thought them up: [Click] and describe. And running them [Click]
  50. Starting on the first example... [Click] and we go red
  51. Now we shoot for green; Like TDD we aim for the smallest change to make the specs pass and if we run the specs we are green! [Click to run] Nope; still red... :state vs ‘state’ [click to show the spec]
  52. Now we shoot for green; Like TDD we aim for the smallest change to make the specs pass and if we run the specs we are green! [Click to run] Nope; still red... :state vs ‘state’ [click to show the spec]
  53. Now we shoot for green; Like TDD we aim for the smallest change to make the specs pass and if we run the specs we are green! [Click to run] Nope; still red... :state vs ‘state’ [click to show the spec]
  54. Now we shoot for green; Like TDD we aim for the smallest change to make the specs pass and if we run the specs we are green! [Click to run] Nope; still red... :state vs ‘state’ [click to show the spec]
  55. Make our adjustment to the spec are we green? [Click] Yes! Its ok to refactor your specs!
  56. Make our adjustment to the spec are we green? [Click] Yes! Its ok to refactor your specs!
  57. Make our adjustment to the spec are we green? [Click] Yes! Its ok to refactor your specs!
  58. Next starting in the off state Red at this point And we add an initialize method [Click] and we go green.
  59. Next starting in the off state Red at this point And we add an initialize method [Click] and we go green.
  60. Next starting in the off state Red at this point And we add an initialize method [Click] and we go green.
  61. and we continue; red to green/yellow
  62. and we continue; red to green/yellow
  63. and we continue; red to green/yellow
  64. and we continue; red to green/yellow
  65. We are starting to repeat ourselfs a bit. In this simple example that not a problem.... but... RSpec has a couple of nice ways to make our lives easier! [Click] Let [Click] Subject
  66. We are starting to repeat ourselfs a bit. In this simple example that not a problem.... but... RSpec has a couple of nice ways to make our lives easier! [Click] Let [Click] Subject
  67. And lets make this switch toggle... and after that we are green and we are done. Notes about this example; - had I had the discussion with the client i would know exactly what examples to write. - I would not have exposed the internal ‘state’ to the test. - could have refactored our switch to use a boolean value - with out effecting our specs
  68. And lets make this switch toggle... and after that we are green and we are done. Notes about this example; - had I had the discussion with the client i would know exactly what examples to write. - I would not have exposed the internal ‘state’ to the test. - could have refactored our switch to use a boolean value - with out effecting our specs
  69. And lets make this switch toggle... and after that we are green and we are done. Notes about this example; - had I had the discussion with the client i would know exactly what examples to write. - I would not have exposed the internal ‘state’ to the test. - could have refactored our switch to use a boolean value - with out effecting our specs
  70. - Its ok to refactor your specs! (not as easy when they are inside of a key note presentation...) - Getting started small - don’t fret skipping difficult things like ‘uploading’ while you are learning - leave your self a pending example instead. - This is not an excuse to never write the spec! Get used to the simple matches - you will be suprised how far they will get you. Next time... mocks and stubs.
  71. - Its ok to refactor your specs! (not as easy when they are inside of a key note presentation...) - Getting started small - don’t fret skipping difficult things like ‘uploading’ while you are learning - leave your self a pending example instead. - This is not an excuse to never write the spec! Get used to the simple matches - you will be suprised how far they will get you. Next time... mocks and stubs.