Behaviour-driven development (BDD) started as an improved variation on test-driven development, but has evolved to become a formidable tool that helps teams communicate more effectively about requirements, using conversation and concrete examples to discover what features really matter to the business. BDD helps teams focus not only on building features that work, but on ensuring that the features they deliver are the ones the client actually needs.
Learn what BDD is, and what it is not
Understand that the core of BDD is around conversation and requirements discovery, not around tools.
Understand the difference and similarities between BDD at the requirements level, and BDD at the coding level.
Learn what BDD tools exist for different platforms, and when to use them
Think BDD is just for web sites? Think again! In this talk, we rethink traditional software testing strategies in the context of micro-services and Behaviour-Driven Development. We will see how traditional testing approaches are both inadequate and poorly targeted for micro-services development. We will learn how to use BDD techniques to discover, describe and document micro-service requirements, and tools like Cucumber and Serenity to turn these requirements into automated acceptance tests and living documentation. We will see how Consumer-Driven Contract tools help ensure that micro-services play well together, and how you can implement the details with the help of unit-testing tools like Spock and REST-Assured.
A common perception of behavior-driven development (BDD) focuses on test automation with Cucumber-style “Given..When..Then” scenarios. But this is just the tip of the iceberg: in fact BDD ranges from requirements discovery and description through to driving technical design and implementation; helping testers focus their testing efforts more effectively; and even providing reliable, useful, and accurate technical documentation.
This session discusses what BDD is about, its benefits, and how it affects development teams and processes. You will see how JVM teams can effectively implement BDD with tools such as JBehave, Cucumber, Thucydides, and Spock. Come learn how much more there is to BDD than just “Given..When..Then.”
Slides from the London Agile Testing Meetup of November 25 2014:
John Ferguson Smart is a specialist in BDD, automated testing and software life cycle development optimization. John is a well-known speaker at many international conferences and events and an accomplished author (John's new book BDD in Action was published last month).
John presents a talk discussing how to write solid, reliable and maintainable automated web tests using the best-of-breed open source technologies like Selenium WebDriver, Serenity, JBehave and Cucumber.
Behaviour-driven development (BDD) started as an improved variation on test-driven development, but has evolved to become a formidable tool that helps teams communicate more effectively about requirements, using conversation and concrete examples to discover what features really matter to the business. BDD helps teams focus not only on building features that work, but on ensuring that the features they deliver are the ones the client actually needs.
Learn what BDD is, and what it is not
Understand that the core of BDD is around conversation and requirements discovery, not around tools.
Understand the difference and similarities between BDD at the requirements level, and BDD at the coding level.
Learn what BDD tools exist for different platforms, and when to use them
Think BDD is just for web sites? Think again! In this talk, we rethink traditional software testing strategies in the context of micro-services and Behaviour-Driven Development. We will see how traditional testing approaches are both inadequate and poorly targeted for micro-services development. We will learn how to use BDD techniques to discover, describe and document micro-service requirements, and tools like Cucumber and Serenity to turn these requirements into automated acceptance tests and living documentation. We will see how Consumer-Driven Contract tools help ensure that micro-services play well together, and how you can implement the details with the help of unit-testing tools like Spock and REST-Assured.
A common perception of behavior-driven development (BDD) focuses on test automation with Cucumber-style “Given..When..Then” scenarios. But this is just the tip of the iceberg: in fact BDD ranges from requirements discovery and description through to driving technical design and implementation; helping testers focus their testing efforts more effectively; and even providing reliable, useful, and accurate technical documentation.
This session discusses what BDD is about, its benefits, and how it affects development teams and processes. You will see how JVM teams can effectively implement BDD with tools such as JBehave, Cucumber, Thucydides, and Spock. Come learn how much more there is to BDD than just “Given..When..Then.”
Slides from the London Agile Testing Meetup of November 25 2014:
John Ferguson Smart is a specialist in BDD, automated testing and software life cycle development optimization. John is a well-known speaker at many international conferences and events and an accomplished author (John's new book BDD in Action was published last month).
John presents a talk discussing how to write solid, reliable and maintainable automated web tests using the best-of-breed open source technologies like Selenium WebDriver, Serenity, JBehave and Cucumber.
It's nice to work on Green Fields projects. But most of us aren't that lucky! Most organisations have large legacy code bases to maintain. And the legacy applications, ugly as they are, are often what generates the revenue!
But legacy code bases are not easy to work with. Adding new features, or even fixing bugs, is slow and fraught with danger. Unexpected regressions are commonplace. Long testing cycles is the norm.
In this talk we will look at some strategies that can enable you to add new features to legacy systems faster and more reliably. We will examine where the hold-ups typically are, and what We will learn how to write cost-effective automated regression tests suites, and how to use unit testing as a way to document your legacy code base for future work, and improve its quality along the way!
The slides of my talk about Vertical vs Horizontal Software Architecture at Equal Expert's Expert Talks Pune on 2019-09-14. It describes why vertical architectures are better than horizontal architectures for the perspective of change and architecture principles, and how this should reflect in the structure of source code.
Behavior Driven Development Pros and ConsIosif Itkin
The Cons of Behavior Driven Development (BDD)
Ivan Bobrov, ClubQA Co-Founder, Kostroma
The Pros of Behavior Driven Development (BDD): Business User Scenarios
Natalia Zaitseva, Exchange Functional Test Automation Lead Innovative Trading Systems
EXTENT Conference.
October 29-30, 2011
Test Automation for Trading Systems
Renaissance Hotel Moscow
Contents:
Behavior Driven Development (BDD)
Features of BDD
BDD Tools
BDD Framework
Examples of Cucumber/SpecFlow/BDD test
Gherkin – BDD Language
The Problem
Example of Gherkin
The Conclusion
SpecFlow Feature File
Keywords for the Feature File creation
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...Agile Testing Alliance
Agile Testing Alliance hosted it's 3rd webinar on "Strengthening your Agility with BDD - A demo using Cucumber". The webinar was hosted on 24th Jan, 2018.
"Given..When..Then"...a common perception of Behaviour Driven Development focuses on writing and automating SpecFlow-style scenarios. In fact this is just a small part of BDD: the full scope of BDD ranges from requirements discovery and description, through to driving technical design and implementation, helping testers focus their testing efforts more effectively, and even providing reliable, useful and accurate technical documentation. In this talk, you will learn about how much more there is to BDD than just "Given..When..Then"!
Almost everything can be done using refactoring tools:
* How to get buy-in for refactoring? (use Technical Debt quantification tools)
* How to identify refactoring candidates? (use smell detection tools)
* How to prioritize / identify what to refactor first? (use reports from design analysis tools)
* How do I identify dependencies and evaluate impact of refactoring? (use visulization tools)
* How to I actually perform refactoring? (Use IDE support for automated refactoring and use them!)
Deriving from a rich experience in using tools for refactoring in real-world projects, this talk takes you through a whirl-wind tour of refactoring tools (of course for Java). What's more, this talk includes quick demos of some of these tools so you can see them in action.
Presented in BoJUG meetup on 19th Jan in Bangalore - https://www.meetup.com/BangaloreOpenJUG/events/257183518/
Domain-Driven Design provee las recomendaciones que Behaviour-Driven Development necesita para hacer de las conversaciones una actividad productiva que permite a Scrum progresar de forma efectiva sobre la visión del software.
We all have seen our share of bad code. We certainly have come across some good code as well. What are the characteristics of good code? How can we identify those? What practices can promote us to write and maintain more of those good quality code. This presentation will focus on this topic that has a major impact on our ability to be agile and succeed.
Behaviour Driven Development is an increasingly popular Agile development practice that turns testing on its head. It turns automated acceptance testing from a verification activity, done once the development work is done, to a specification activity, with tester involvement starting from the word go.
In this talk, we will look at how Behaviour Driven Development radically changes the traditional tester role in Agile projects, and empowers them to contribute much more to the successful outcomes of the project. We will see how collaboratively written acceptance criteria help reduce assumptions and errors in the early phases of the project, and help ensure that the features being built are both well understood and valuable to the business. We will look at ways to write more effective, easier to maintain automated acceptance tests. And we will see how automated and manual acceptance test reporting can be combined to provide valuable progress and release preparation reporting.
It's nice to work on Green Fields projects. But most of us aren't that lucky! Most organisations have large legacy code bases to maintain. And the legacy applications, ugly as they are, are often what generates the revenue!
But legacy code bases are not easy to work with. Adding new features, or even fixing bugs, is slow and fraught with danger. Unexpected regressions are commonplace. Long testing cycles is the norm.
In this talk we will look at some strategies that can enable you to add new features to legacy systems faster and more reliably. We will examine where the hold-ups typically are, and what We will learn how to write cost-effective automated regression tests suites, and how to use unit testing as a way to document your legacy code base for future work, and improve its quality along the way!
The slides of my talk about Vertical vs Horizontal Software Architecture at Equal Expert's Expert Talks Pune on 2019-09-14. It describes why vertical architectures are better than horizontal architectures for the perspective of change and architecture principles, and how this should reflect in the structure of source code.
Behavior Driven Development Pros and ConsIosif Itkin
The Cons of Behavior Driven Development (BDD)
Ivan Bobrov, ClubQA Co-Founder, Kostroma
The Pros of Behavior Driven Development (BDD): Business User Scenarios
Natalia Zaitseva, Exchange Functional Test Automation Lead Innovative Trading Systems
EXTENT Conference.
October 29-30, 2011
Test Automation for Trading Systems
Renaissance Hotel Moscow
Contents:
Behavior Driven Development (BDD)
Features of BDD
BDD Tools
BDD Framework
Examples of Cucumber/SpecFlow/BDD test
Gherkin – BDD Language
The Problem
Example of Gherkin
The Conclusion
SpecFlow Feature File
Keywords for the Feature File creation
Wednesday Webinar on "Strengthening your Agility with BDD - A demo using Cucu...Agile Testing Alliance
Agile Testing Alliance hosted it's 3rd webinar on "Strengthening your Agility with BDD - A demo using Cucumber". The webinar was hosted on 24th Jan, 2018.
"Given..When..Then"...a common perception of Behaviour Driven Development focuses on writing and automating SpecFlow-style scenarios. In fact this is just a small part of BDD: the full scope of BDD ranges from requirements discovery and description, through to driving technical design and implementation, helping testers focus their testing efforts more effectively, and even providing reliable, useful and accurate technical documentation. In this talk, you will learn about how much more there is to BDD than just "Given..When..Then"!
Almost everything can be done using refactoring tools:
* How to get buy-in for refactoring? (use Technical Debt quantification tools)
* How to identify refactoring candidates? (use smell detection tools)
* How to prioritize / identify what to refactor first? (use reports from design analysis tools)
* How do I identify dependencies and evaluate impact of refactoring? (use visulization tools)
* How to I actually perform refactoring? (Use IDE support for automated refactoring and use them!)
Deriving from a rich experience in using tools for refactoring in real-world projects, this talk takes you through a whirl-wind tour of refactoring tools (of course for Java). What's more, this talk includes quick demos of some of these tools so you can see them in action.
Presented in BoJUG meetup on 19th Jan in Bangalore - https://www.meetup.com/BangaloreOpenJUG/events/257183518/
Domain-Driven Design provee las recomendaciones que Behaviour-Driven Development necesita para hacer de las conversaciones una actividad productiva que permite a Scrum progresar de forma efectiva sobre la visión del software.
We all have seen our share of bad code. We certainly have come across some good code as well. What are the characteristics of good code? How can we identify those? What practices can promote us to write and maintain more of those good quality code. This presentation will focus on this topic that has a major impact on our ability to be agile and succeed.
Behaviour Driven Development is an increasingly popular Agile development practice that turns testing on its head. It turns automated acceptance testing from a verification activity, done once the development work is done, to a specification activity, with tester involvement starting from the word go.
In this talk, we will look at how Behaviour Driven Development radically changes the traditional tester role in Agile projects, and empowers them to contribute much more to the successful outcomes of the project. We will see how collaboratively written acceptance criteria help reduce assumptions and errors in the early phases of the project, and help ensure that the features being built are both well understood and valuable to the business. We will look at ways to write more effective, easier to maintain automated acceptance tests. And we will see how automated and manual acceptance test reporting can be combined to provide valuable progress and release preparation reporting.
Sharon Needles channeling Sleeping Beauty's Maleficent
Manila Luzon channeling 101 Dalmatians' Cruella De Vil
Latrice Royale channeling The Little Mermaid's Ursula
Raven channeling Snow White's Evil Queen
Chad Michaels channeling Cinderella's Lady Tremaine
Jiggly Caliente channeling Alice in Wonderland's Queen of Hearts
Yara Sofia channeling The Emperor's New Groove's Yzma
An overview of Behavioral Driven Development (BDD). This deck covers the basics with an overview as well as some information on why to use Behavioral Driven Development.
This topic covers how business requirements are used to drive development using Behavior Driven Development (BDD) and its predecessor, Test Driven Development (TDD).
Enter the mind of an Agile Developer, BSG shares with you how we do software development and how to embed agile methodologies into your development process.
"Different software evolutions from Start till Release in PHP product" Oleksa...Fwdays
Ця розповідь розкриє підходи для вирішення багатьох проблем в PHP проєктах через: None-Breaking change development підхід, cross-stack контракти, Trunk Based development, еволюція з Polyrepo до Monorepo з компонентами на різних технологіях, Boilerplat’и компонентів, різні Architecture View, Continuous Testing & Quality, Infrastructure View, Infrastructure as a code як основний інструмент.
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...Alexandr Savchenko
https://fwdays.com/en/event/php-fwdays-2020
All of us think about many questions when we start a project, when we already have a product and when we release it. Here are some of them: which architecture and infrastructure to choose? what should be the repository structure? how to make the right evolution from one application to 100 microservices with success product release? how to distribute cross-stack commands as a whole? what development practices to use?
This story will expose approaches to solving these and many other problems in PHP projects through: None-Breaking change development approach, Cross-stack contacts, Trunk Based development, evolution from Polyrepo to Monorepo with components on different technologies, Boilerplates for components, different Architecture Views, Continuous Testing & Quality, Infrastructure View, Infrastructure as a code as the main tool.
This topic will appeal to everyone - from Software Developer to Architect, as many Tips & Tricks will be revealed.
Tdd vs bdd vs atdd — developers’ methodologies to navigate complex developmen...Katy Slemon
Know key differences between major development methodologies TDD vs BDD vs ATDD in this post that focus on the task of the developers and their creations
Building In Quality: The Beauty Of Behavior Driven Development (BDD)Synerzip
Behavior Driven Development (BDD) began as a means of helping developers practice Test Driven Development (TDD).
In this it was successful, but it quickly proved its value in many other ways. In this presentation, Larry Apke quotes heavily from the work of Uncle Bob Martin to make the case for TDD and then explains how developers can use BDD to take advantage of this excellent software development practice.
Larry also talks about his “Ten Reasons BDD Changes Everything” along with some easy ways to begin implementation of BDD in your software development organization immediately and what the corresponding future steps would be to take full advantage of this technique.
A study of the characteristics of Behaviour Driven DevelopmentCarlos Solís
We present a set of main BDD characteristics identified through an analysis of relevant literature and current BDD toolkits.
http://ulir.ul.ie/bitstream/handle/10344/1256/Solis_2011_behaviour.pdf
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
8. 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
9. WTF
I thought BDD was just TDD but with words like context and
should?
10. 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
11. • 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
12. • 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
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.
- 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.
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]
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]
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]
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]
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]
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
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
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
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.
create sandbox app
to play around with.
20 seconds on Gemfile;
[Click to hide all but rspec lines]
20 seconds on Gemfile;
[Click to hide all but rspec lines]
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
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
[Click for tweaks to home directory]
5 seconds on the helper;
[click to hide standard stuff]
5 seconds on the helper;
[click to hide standard stuff]
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)
Highlight the nice structure;
- .rspec file makes things pretty ‘--format nested’
Highlight the summary line; 1 example, 1 pending
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.
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.
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.
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
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
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
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
Describe the matches
.. Lets try some of these out.
Describe the matches
.. Lets try some of these out.
Describe the matches
.. Lets try some of these out.
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]
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]
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]
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]
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]
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]
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]
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]
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
Lets start with a spec;
/spec/models/switch_spec.rb
and if we run it [Click]
Bah!... not good.
Oh wait. [Click]
Lets start with a spec;
/spec/models/switch_spec.rb
and if we run it [Click]
Bah!... not good.
Oh wait. [Click]
We add the model to the rails project
and running the specs [Click]
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]
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]
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]
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]
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]
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]
Starting on the first example...
[Click] and we go red
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]
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]
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]
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]
Make our adjustment to the spec
are we green? [Click]
Yes!
Its ok to refactor your specs!
Make our adjustment to the spec
are we green? [Click]
Yes!
Its ok to refactor your specs!
Make our adjustment to the spec
are we green? [Click]
Yes!
Its ok to refactor your specs!
Next starting in the off state
Red at this point
And we add an initialize method [Click]
and we go green.
Next starting in the off state
Red at this point
And we add an initialize method [Click]
and we go green.
Next starting in the off state
Red at this point
And we add an initialize method [Click]
and we go green.
and we continue; red to green/yellow
and we continue; red to green/yellow
and we continue; red to green/yellow
and we continue; red to green/yellow
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
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
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
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
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
- 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.
- 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.