SlideShare ist ein Scribd-Unternehmen logo
1 von 81
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/

Weitere ähnliche Inhalte

Was ist angesagt?

Vertical vs Horizontal Software Architecture
Vertical vs Horizontal Software ArchitectureVertical vs Horizontal Software Architecture
Vertical vs Horizontal Software ArchitectureChristian Hujer
 
Getting Comfortable with BDD
Getting Comfortable with BDDGetting Comfortable with BDD
Getting Comfortable with BDDAlex Sharp
 
Behavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsBehavior Driven Development Pros and Cons
Behavior Driven Development Pros and ConsIosif Itkin
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineRemus 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
 
Applying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeApplying Refactoring Tools in Practice
Applying Refactoring Tools in PracticeGanesh Samarthyam
 
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 QualitySaltmarch 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 Testingsjmarsh
 
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 JavaJawad Khan
 
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 projectsKaty Slemon
 

Was ist angesagt? (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
 

Andere mochten auch

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

Andere mochten auch (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
 

Ähnlich wie TorontoRb Intro to BDD

BDD presentation
BDD presentationBDD presentation
BDD presentationtemebele
 
Behavior Driven Development
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentAdam Englander
 
DevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDays Jakarta Igites
DevOpsDays Jakarta IgitesDevOpsDaysJKT
 
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 SpecFlowSarah 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 CucumberKnoldus 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 DeveloperBSGAfrica
 
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
 
"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
 
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 EastmanQA 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
 
Rhapsody reverseengineering
Rhapsody reverseengineeringRhapsody reverseengineering
Rhapsody reverseengineeringScott 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 DeutschlandMurphy 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 DevelopmentCarlos Solís
 

Ähnlich wie 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
 
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 ...
 
"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...
 
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
 

Kürzlich hochgeladen

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
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
 
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
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Kürzlich hochgeladen (20)

Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
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
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
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
 
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
 
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
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

TorontoRb Intro to BDD

Hinweis der Redaktion

  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.