This document provides an overview of behavior driven development (BDD) and Cucumber, a tool for BDD. It discusses BDD concepts like user stories, outside-in development, and the red-green-refactor cycle. It then covers installing and getting started with Cucumber in a Rails application, including writing features, step definitions, and using helpers like Webrat. It also notes potential "smells" to watch out for with Cucumber and provides additional resources.
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
Rubyconf2016 - Solving communication problems in distributed teams with BDDRodrigo Urubatan
This was my talk in Rubyconf Brazil 2016, it summarises some of my experience using BDD to improve team interaction and communication in local and distributed teams, what are the differences, what benefits I found and how I used it.
I mainly focus in BDD as a communication tool, the automated tests are only a very good side effect, but I've already used it without test automation too.
DDD/CQRS - I must learn to repeat myselfDouglas Reith
Bringing back to basics the benefits of CQRS/DDD in terms of the basic truths of software development. Learning to repeat myself to get to a better architecture.
Code quality directly impacts how easy or hard your job is. The higher the quality, the easier it is for anyone (including you) to quickly jump in and get to work. Where do you start? In this session, Tonya Mork will empower you to simplify your code while dramatically increasing its code quality.
It's all about building <human code>, code that is highly human readable and understandable.
This slide deck is from a session I gave for WPSessions. https://wpsessions.com/sessions/code-quality-makes-jobs-easier/
This presentation is by Doug Crockford, I'm reposting it here from this Google Blog post: http://googlecode.blogspot.com/2009/03/doug-crockford-javascript-good-parts.html
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
Rubyconf2016 - Solving communication problems in distributed teams with BDDRodrigo Urubatan
This was my talk in Rubyconf Brazil 2016, it summarises some of my experience using BDD to improve team interaction and communication in local and distributed teams, what are the differences, what benefits I found and how I used it.
I mainly focus in BDD as a communication tool, the automated tests are only a very good side effect, but I've already used it without test automation too.
DDD/CQRS - I must learn to repeat myselfDouglas Reith
Bringing back to basics the benefits of CQRS/DDD in terms of the basic truths of software development. Learning to repeat myself to get to a better architecture.
Code quality directly impacts how easy or hard your job is. The higher the quality, the easier it is for anyone (including you) to quickly jump in and get to work. Where do you start? In this session, Tonya Mork will empower you to simplify your code while dramatically increasing its code quality.
It's all about building <human code>, code that is highly human readable and understandable.
This slide deck is from a session I gave for WPSessions. https://wpsessions.com/sessions/code-quality-makes-jobs-easier/
This presentation is by Doug Crockford, I'm reposting it here from this Google Blog post: http://googlecode.blogspot.com/2009/03/doug-crockford-javascript-good-parts.html
Continuous (Production) Integration: Ruby on Rails Application Monitoring wit...jnewland
Feature: Ruby on Rails Application Monitoring with Cucumber
In order to ensure continuous application availability
A developer should be able to assert the behavior of production apps
From the outside in
Without using antiquated monitoring tools
To protect revenue
NextJS - Online Summit for Frontend Developers September 2020Milad Heydari
Developers may think launching SSR application with react must be painful. In this talk, i was describe a simple SSR method, does a deep dive into SSR with Next.js, and how i using it. it's about some useful tips about challenges, optimizations, writing clean codes beside do’s and don’ts in Next.js and cover many of the Next.js features to accomplish a great website application with acceptable performance and speed.
React Global Online Summit for Frontend Developers.
September 2020
https://react.geekle.us/september-2020
https://youtu.be/fkp5_5rezsE
Upgrade Your Website to HTML5 - VSLive Conference New York @iRajLalRaj Lal
Learn what you need to do, to upgrade your existing web application with HTML5. How and Where do you start? Learn how you capitalize on the State-of-the-Art HTML5 tags, Cutting edge graphics and animation with CSS3, and advanced HTML5 API and take your existing website to the next level of Web revolution.
You will learn:
Upgrade your current website with HTML5
Use advanced HTML5 APIs which gracefully degrade
Know how to enhance your website with the latest HTML5 goodies
An Introduction to React -- FED Date -- IBM DesignJosh Black
An introduction to React.js presented as part of an internal sharing event inside of IBM Design. This talk tries to cover what React is actually trying to do, versus explaining how to use it.
Does Behaviour Driven Development have a role in the infrastructure world? Enter Behaviour Driven Infrastructure where systems administrators can apply some simple open source tools and BDD principles to make infrastructure management more powerful, more insightful and deliver more value to their customers.
The typical enterprise monitoring and configuration management set-up for a website is:
- Is the Apache package installed and the appropriate version?
- Is the Apache service running?
- Can I connect to the HTTP port and is HTML returned?
- Multiply this by a few hundred iterations of hosts and types of services and you’re probably looking at your typical Nagios, Puppet, Cfengine, Hyperic set-up.
All this monitoring misses something critical though – we’re not actually monitoring that the service does what it should. Yes, it matters whether Apache is installed, the Apache service is running, and you can connect to HTTP but does this actually prove anything about the availability of the service we’re managing and providing for our customers? Nope…
We need to demonstrate more than just a check that says the Apache server is up. We need to demonstrate that the service delivered by that infrastructure was available to our customers AND functioning as intended.
Enter Behaviour Driven Infrastructure or BDI which applies the principles of Behavioural Driven Development to the management of infrastructure. In this presentation you’ll learn:
- How Behaviour Driven Development works
- What makes a behavioural test
- How to install and use Cucumber to perform BDI
- Practical examples of behavioural tests in Cucumber, and
- How to integrate BDI into your work flow and your enterprise monitoring and configuration management frameworks.
Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your Drupal site. These stories can then be auto-tested against your website, whether in the midst of development, or on a live site. And yes, it’s as cool as it sounds!
Behat, if embraced by enough Drupal folks, has the potential to vastly improve the way we build and test Drupal websites. Testing language can be developed by module maintainers, and allow nearly codefree testing to be developed by everyone, as needed, per site.
Behat IS NOT unit testing nor a specification testing tool. Behat is a Scenario-oriented BDD framework with functional testing capabilities as part of a communication process between stake-holders and developers. Think Agile User Stories meets Selenium.
Behat is currently used to test Drupal.org, allowing a variety of coders to work on a single site, and ensure that no existing functionality will break as they add new features. Or as it's migrated from one version to another. Imagine that on your site.
We will review Behat (and Mink, and related code), how to use it with Drupal, Drush, and the existing modules/code to support that. We will demo live testing, and so how easy it is to write tests, with and without code.
Faster! Faster! Accelerate your business with blazing prototypesOSCON Byrum
Bring your ideas to life! Convince your boss to that open source development is faster and cheaper than the "safe" COTS solution they probably hate anyway. Let's investigate ways to get real-life, functional prototypes up with blazing speed. We'll look at and compare tools for truly rapid development including Python, Django, Flask, PHP, Amazon EC2 and Heroku.
Learn how to optimize your Upwork profile and get more views on your profile! There is so much competition on Upwork, wouldn't you like to stand out? Time to dominate Upwork!
BigDL: Image Recognition Using Apache Spark with BigDL - MCL358 - re:Invent 2017Amazon Web Services
In this talk, you will learn how to use, or create Deep Learning architectures for Image Recognition and other neural network computations in Apache Spark. Alex, Tim and Sujee will begin with an introduction to Deep Learning using BigDL. Then they will explain and demonstrate how image recognition works using step by step diagrams, and code which will give you a fundamental understanding of how you can perform image recognition tasks within Apache Spark. Then, they will give a quick overview of how to perform image recognition on a much larger dataset using the Inception architecture. BigDL was created specifically for Spark and takes advantage of Spark’s ability to distribute data processing workloads across many nodes. As an attendee in this session, you will learn how to run the demos on your laptop, on your own cluster, or use the BigDL AMI in the AWS Marketplace. Either way, you walk away with a much better understanding of how to run deep learning workloads using Apache Spark with BigDL.
Session sponsored by Intel
More Related Content
Similar to Getting Up and Running with BDD on Rails
Continuous (Production) Integration: Ruby on Rails Application Monitoring wit...jnewland
Feature: Ruby on Rails Application Monitoring with Cucumber
In order to ensure continuous application availability
A developer should be able to assert the behavior of production apps
From the outside in
Without using antiquated monitoring tools
To protect revenue
NextJS - Online Summit for Frontend Developers September 2020Milad Heydari
Developers may think launching SSR application with react must be painful. In this talk, i was describe a simple SSR method, does a deep dive into SSR with Next.js, and how i using it. it's about some useful tips about challenges, optimizations, writing clean codes beside do’s and don’ts in Next.js and cover many of the Next.js features to accomplish a great website application with acceptable performance and speed.
React Global Online Summit for Frontend Developers.
September 2020
https://react.geekle.us/september-2020
https://youtu.be/fkp5_5rezsE
Upgrade Your Website to HTML5 - VSLive Conference New York @iRajLalRaj Lal
Learn what you need to do, to upgrade your existing web application with HTML5. How and Where do you start? Learn how you capitalize on the State-of-the-Art HTML5 tags, Cutting edge graphics and animation with CSS3, and advanced HTML5 API and take your existing website to the next level of Web revolution.
You will learn:
Upgrade your current website with HTML5
Use advanced HTML5 APIs which gracefully degrade
Know how to enhance your website with the latest HTML5 goodies
An Introduction to React -- FED Date -- IBM DesignJosh Black
An introduction to React.js presented as part of an internal sharing event inside of IBM Design. This talk tries to cover what React is actually trying to do, versus explaining how to use it.
Does Behaviour Driven Development have a role in the infrastructure world? Enter Behaviour Driven Infrastructure where systems administrators can apply some simple open source tools and BDD principles to make infrastructure management more powerful, more insightful and deliver more value to their customers.
The typical enterprise monitoring and configuration management set-up for a website is:
- Is the Apache package installed and the appropriate version?
- Is the Apache service running?
- Can I connect to the HTTP port and is HTML returned?
- Multiply this by a few hundred iterations of hosts and types of services and you’re probably looking at your typical Nagios, Puppet, Cfengine, Hyperic set-up.
All this monitoring misses something critical though – we’re not actually monitoring that the service does what it should. Yes, it matters whether Apache is installed, the Apache service is running, and you can connect to HTTP but does this actually prove anything about the availability of the service we’re managing and providing for our customers? Nope…
We need to demonstrate more than just a check that says the Apache server is up. We need to demonstrate that the service delivered by that infrastructure was available to our customers AND functioning as intended.
Enter Behaviour Driven Infrastructure or BDI which applies the principles of Behavioural Driven Development to the management of infrastructure. In this presentation you’ll learn:
- How Behaviour Driven Development works
- What makes a behavioural test
- How to install and use Cucumber to perform BDI
- Practical examples of behavioural tests in Cucumber, and
- How to integrate BDI into your work flow and your enterprise monitoring and configuration management frameworks.
Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your Drupal site. These stories can then be auto-tested against your website, whether in the midst of development, or on a live site. And yes, it’s as cool as it sounds!
Behat, if embraced by enough Drupal folks, has the potential to vastly improve the way we build and test Drupal websites. Testing language can be developed by module maintainers, and allow nearly codefree testing to be developed by everyone, as needed, per site.
Behat IS NOT unit testing nor a specification testing tool. Behat is a Scenario-oriented BDD framework with functional testing capabilities as part of a communication process between stake-holders and developers. Think Agile User Stories meets Selenium.
Behat is currently used to test Drupal.org, allowing a variety of coders to work on a single site, and ensure that no existing functionality will break as they add new features. Or as it's migrated from one version to another. Imagine that on your site.
We will review Behat (and Mink, and related code), how to use it with Drupal, Drush, and the existing modules/code to support that. We will demo live testing, and so how easy it is to write tests, with and without code.
Faster! Faster! Accelerate your business with blazing prototypesOSCON Byrum
Bring your ideas to life! Convince your boss to that open source development is faster and cheaper than the "safe" COTS solution they probably hate anyway. Let's investigate ways to get real-life, functional prototypes up with blazing speed. We'll look at and compare tools for truly rapid development including Python, Django, Flask, PHP, Amazon EC2 and Heroku.
Learn how to optimize your Upwork profile and get more views on your profile! There is so much competition on Upwork, wouldn't you like to stand out? Time to dominate Upwork!
BigDL: Image Recognition Using Apache Spark with BigDL - MCL358 - re:Invent 2017Amazon Web Services
In this talk, you will learn how to use, or create Deep Learning architectures for Image Recognition and other neural network computations in Apache Spark. Alex, Tim and Sujee will begin with an introduction to Deep Learning using BigDL. Then they will explain and demonstrate how image recognition works using step by step diagrams, and code which will give you a fundamental understanding of how you can perform image recognition tasks within Apache Spark. Then, they will give a quick overview of how to perform image recognition on a much larger dataset using the Inception architecture. BigDL was created specifically for Spark and takes advantage of Spark’s ability to distribute data processing workloads across many nodes. As an attendee in this session, you will learn how to run the demos on your laptop, on your own cluster, or use the BigDL AMI in the AWS Marketplace. Either way, you walk away with a much better understanding of how to run deep learning workloads using Apache Spark with BigDL.
Session sponsored by Intel
Similar to Getting Up and Running with BDD on Rails (20)
BigDL: Image Recognition Using Apache Spark with BigDL - MCL358 - re:Invent 2017
Getting Up and Running with BDD on Rails
1. Behavior Driven Development
with elegance and joy
Getting Up and Running
with BDD on Rails
Nicholas Cancelliere
email: ncancelliere@gmail.com
twitter: ozmox
2. Overview
Behavior Driven Development Basic Concepts
Cucumber from 10,000 ft
Cucumber in the Rails Environment
Writing your first Feature / Scenario
Additional Resources
3. Behavior Driven
“the next step” from Test-Driven Development
tests what an object does rather than what it is
intention more important than implementation
outside-in approach
offers all the benefits of TDD
it is not Test-After Development
4. Benefits of TDD/BDD
more productive (less debugging, fewer prod defects)
helps drive programming design (KISS/YAGNI)
delays implementation decisions
greater level of code trust
code more modularized, flexible and extensible
5. Outside-In
User
Client
Value is in the views!
Views Often html but can also be programmatic
interfaces (such as XML or JSON),
Controllers remember valuable to the user.
Model
6. Red Green Refactor
write enough
test code to fail write just
enough code to
pass
review your
work and
refactor
7. Red Green Refactor
write enough
test code to fail write just
enough code to
pass
review your
work and
refactor
8. Red Green Refactor
write enough
test code to fail write just
enough code to
pass
review your
work and
refactor
9. Red Green Refactor
write enough
test code to fail write just
enough code to
pass
review your
work and
refactor
10. User Stories
concept popular in Agile practices like Scrum and XP
define the user’s role, what it is they need/want to do,
and why they need/want (the value)
As a us e r
w i t h an a
c o n t ac t s ddre s s b o
so I c an e o k , I ne e d
As a u s e r a s i l y re t r t o a dd
w i t h an a ie ve t h e m
e di t/de le t ddre s s b o l ate r.
e c o n t ac t o k , I ne e d
s so I c an
d a te a n d ke e p i t up to
m a n ag e a -to-
As a us e r ble .
w i t h an a
my c on t a ddre s s b o
c ts to o t h o k , I ne e d
e r us e rs t to se nd
o be sh a r
e d.
11. Pop the Why Stack
Ask “Why” up to 5 times
Stop when you find the money
Protect revenue
Increase revenue
Manage cost
12. Example Pop’in
c: ‘People need to log in.’
d: ‘Why?’
c: ‘Um, identify users?’
d: ‘Why do you need to identify users?’
c: ‘So we know who’s publishing what.’
d: ‘Why would you need to know who publishes what?’
c: ‘If content belongs to someone it seems trustworthy.’
d: ‘Why does content need to be trustworthy?’
c: ‘People will be more interested in the content if so.’
d: ‘Why do you need people interested in the content?’
c: ‘So people come back and visit the site?’
d: ‘Why do you want people to come back and revisit?’
c: ‘More visits will increase our ad revenue.’
13. The Story
As an author, I need to log into the site
so that articles I create are associated to me
and seem trustworthy, driving more traffic to the site.
14. The Story
So that articles I create are associated to me, seem
trustworthy and drive more traffic to the site,
as an author, I need to log in.
15. Enter Cucumber
Dan North ported JBehave to Ruby as RBehave
RSpec merged RBehave in as the Story Runner
First only supported Ruby for scenarios
Later supported plain text, but still limited
Aslak Hellesøy in 2008 rewrote Story Runner as
Cucumber (named so by his fiancée)
Cucumber has since taken to a life of it’s own
16. Cucumber
written in Ruby itself and best matched with Ruby
projects, but can be used for Java, .NET or Flex
supports web apps in any language:
integrates with Webrat, Watir, Selenium, et. al.
Gherkin customization edit /cucumber/languages.yml
minimum knowledge of Ruby required, you can pick it
up and get going in a few days
17. Gherkin: the ‘unpickle’ variety
a business readable, domain specific language that
Cucumber understands
two-stage parser for input file (plain text):
1. divides the file into sections (eg. feature, scenarios)
2. sections are divided into steps
step-definitions are always matched by Ruby methods
line-oriented (like YAML); line endings terminate
statements (steps) and spaces or tabs to indent
18. Given When Then
Used extensively in scenario definitions (Gherkin)
Use “And” to chain together
Given an invalid user
When I go to the sign-in page
And I fill in "userlogin" with "baduser"
And I fill in "password" with "badpassword"
And I submit "new_user_session"
Then I should see "Sorry, we could not sign you in."
And I should see "Login"
21. Out of the Box
Webrat comes with a bunch of handy helpers out of the
box to make life easy for web application scenarios
rake features - task to run all Cucumber tests
/features
review_past_events.feature
/step_definitions
event_steps.rb
webrat_steps.rb
/support
env.rb
paths.rb
37. Remember...
Cucumber defines the features you wish you had.
RSpec (or Test::Unit) defines the interactions and
objects you wish you had.
You’re building a business domain language!
39. What do I use?
Speed
Selenium +
Webrat
Unit Testing +
Integration
40. Cucumber Smells
Relying too much on state in your step-definitions
Tests with no user value
Too much concrete, less abstract
41. Cucumber Smells
Relying too much on state in your step-definitions
Tests with no user value
Too much concrete, less abstract
Given /^state$/ do
@article = Article.create!
end
Given /^coupled by state/ do
@article.title = ‘Bad’
end
42. Cucumber Smells
Relying too much on state in your step-definitions
Tests with no user value
Too much concrete, less abstract
Given /^check the db/ do
Article.find(1).should_not == nil
end
43. Cucumber Smells
Relying too much on state in your step-definitions
Tests with no user value
Too much concrete, less abstract
Given I go to the login page
And I fill in “username” with “john”
And I fill in “password” with “testpass”
And I click “login”
44. Cucumber Smells
Relying too much on state in your step-definitions
Tests with no user value
Too much concrete, less abstract
Given I’m logged in
45. Cucumber Smells
Relying too much on state in your step-definitions
Tests with no user value
Too much concrete, less abstract
Given /I am logged in/ do
@user = User.create!(:login => ‘john’,
:password => ‘testpass’)
And ‘I fill in “username” with “john”’
And ‘I fill in “password” with “testpass”’
And ‘I click “login”’
end
46. Additional Resources /
Topics
http://cukes.info
The RSpec Book (beta @ PragProg.com)
Textmate Bundles are available!
Extending Cucumber with World
Using Hooks (careful they’re global)