Your SlideShare is downloading. ×
0
human-readable automated testing






Who
What
Why
Where
How






Who am I? Who should use this?
What
Why
Where
How






Who am I? Who should use this?
What is Behat?
Why
Where
How






Who am I? Who should use this?
What is Behat?
Why should you care?
Where
How






Who am I? Who should use this?
What is Behat?
Why should you care?
Where did this come from?
How






Who am I? Who should use this?
What is Behat?
Why should you care?
Where did this come from?
How does it work? ...
Seth Cohn
 @sethcohn at drupal.org,

twitter, and elsewhere
 Almost 9 years of Drupal
 Worked as independent,
part of d...


Who is the target of this talk?
 Developers who want to be clear on what they are





being asked to build
Projec...
What is Behat?
“Behat is a tool that makes behavior driven
development (BDD) possible.”
http://docs.behat.org
first line o...
What is that?
Coined by Dan North, http://dannorth.net
who was teaching Test Driven
Development, and asking questions like...
What is that?
Coined by Dan North, http://dannorth.net
who was teaching Test Driven
Development, and asking questions like...
What is that?
Coined by Dan North, http://dannorth.net
who was teaching Test Driven Development,
and asking questions like...
What is that?
Coined by Dan North, http://dannorth.net
who was teaching Test Driven
Development, and asking questions like...
What is that?
Coined by Dan North, http://dannorth.net
who was teaching Test Driven Development,
and asking questions like...
What is that?
Coined by Dan North, http://dannorth.net
who was teaching Test Driven Development,
and asking questions like...
• UI
• Service
• Unit
http://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid

* no re...
• UI
• Service
• Unit
http://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid

* no re...
BDD rethinks testing:



should be written in order of business value
should use the standard agile framework of a
User ...
BDD rethinks testing:



should be written in order of business value
should use the standard agile framework of a
User ...
BDD rethinks testing:



should be written in order of business value
should use the standard agile framework of a
User ...
BDD rethinks testing:



should be written in order of business value
should use the standard agile framework of a
User ...
BDD rethinks testing:



should be written in order of business value
should use the standard agile framework of a
User ...
BDD rethinks testing:



should be written in order of business value
should use the standard agile framework of a
User ...
What is Behat?
Behat is a PHP clone of Cucumber
(which was written in Ruby).
It works with Mink, to….
What is Behat?
Behat is a PHP clone of Cucumber
(which was written in Ruby).
It works with Mink, to….
WHA? Ok, let’s try a...


Behat tests the
behavior of your
application described
in special language
called Gherkin.


Behat tests the
behavior of your
application described
in special language
called Gherkin.



Behat is a clone of a
si...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a “Business
Readab...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a “Business
Readab...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Behat tests the
behavior of your
application described
in special language
called Gherkin.
 Gherkin is a Business
Readabl...
Or how the heck does this work?

• Sites we don’t control (blackbox) –
Wikipedia demo example
• Sites we do control (but s...


Benefits to community
 Better testing of all of the code,

especially code you didn’t author yourself


Benefits to d...
Modules at Drupal.org:
 behat: It allows you to write feature tests for
a Drupal site using SimpleTest API functions
and ...


Why does Drupal.org now use Behat?
 Developers don’t get access to the main Drupal

boxes…
 Breaking Drupal.org is a ...


Behat Drupal Group
http://groups.drupal.org/behat



Melissa’s articles in Drupal Watchdog
 http://drupalwatchdog.com...


The entire team at BioRAFT and especially
 Nathan & Ben, the CEO & CTO who ‘get it’
 Jeremy, Justin, Dan, Diliny, & M...
Upcoming SlideShare
Loading in...5
×

Behat - human-readable automated testing

792

Published on

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.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
792
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Behat - human-readable automated testing"

  1. 1. human-readable automated testing
  2. 2.      Who What Why Where How
  3. 3.      Who am I? Who should use this? What Why Where How
  4. 4.      Who am I? Who should use this? What is Behat? Why Where How
  5. 5.      Who am I? Who should use this? What is Behat? Why should you care? Where How
  6. 6.      Who am I? Who should use this? What is Behat? Why should you care? Where did this come from? How
  7. 7.      Who am I? Who should use this? What is Behat? Why should you care? Where did this come from? How does it work? How can you use it?
  8. 8. Seth Cohn  @sethcohn at drupal.org, twitter, and elsewhere  Almost 9 years of Drupal  Worked as independent, part of development companies, non-profits, and more..  Elected in NH in 2010 as State Representative, prime sponsored the first Open Source/Open Data bill passed into law in USA
  9. 9.  Who is the target of this talk?  Developers who want to be clear on what they are     being asked to build Project Managers who want to be clear on what they are requesting be built Anyone using Agile methods or who wants to… End Users working to get new useful features built Anyone wanting to drive focused development
  10. 10. What is Behat? “Behat is a tool that makes behavior driven development (BDD) possible.” http://docs.behat.org first line of the quick intro So let’s ask what BDD is?
  11. 11. What is that? Coined by Dan North, http://dannorth.net who was teaching Test Driven Development, and asking questions like: o Where to start in the process? o What to test and what not to test? o How much to test in one go? o What to call the tests? o How to understand why a test fails?
  12. 12. What is that? Coined by Dan North, http://dannorth.net who was teaching Test Driven Development, and asking questions like:      Where to start in the process? What to test and what not to test? How much to test in one go? What to call the tests? How to understand why a test fails?
  13. 13. What is that? Coined by Dan North, http://dannorth.net who was teaching Test Driven Development, and asking questions like:      Where to start in the process? What to test and what not to test? How much to test in one go? What to call the tests? How to understand why a test fails?
  14. 14. What is that? Coined by Dan North, http://dannorth.net who was teaching Test Driven Development, and asking questions like:      Where to start in the process? What to test and what not to test? How much to test in one go? What to call the tests? How to understand why a test fails?
  15. 15. What is that? Coined by Dan North, http://dannorth.net who was teaching Test Driven Development, and asking questions like:      Where to start in the process? What to test and what not to test? How much to test in one go? What to call the tests? How to understand why a test fails?
  16. 16. What is that? Coined by Dan North, http://dannorth.net who was teaching Test Driven Development, and asking questions like:      Where to start in the process? What to test and what not to test? How much to test in one go? What to call the tests? How to understand why a test fails?
  17. 17. • UI • Service • Unit http://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid * no relation
  18. 18. • UI • Service • Unit http://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid * no relation
  19. 19. BDD rethinks testing:   should be written in order of business value should use the standard agile framework of a User story:  "As a [role] I want [feature] so that [benefit]”  should be written with Acceptance criteria in terms of scenarios and implemented as classes:  Given [initial context], when [event occurs], then [ensure some outcomes]
  20. 20. BDD rethinks testing:   should be written in order of business value should use the standard agile framework of a User story:  "As a [role] I want [feature] so that [benefit]”  should be written with Acceptance criteria in terms of scenarios and implemented as classes:  Given [initial context], when [event occurs], then [ensure some outcomes]
  21. 21. BDD rethinks testing:   should be written in order of business value should use the standard agile framework of a User story:  "As a [role] I want [feature] so that [benefit]”  should be written with Acceptance criteria in terms of scenarios and implemented as classes:  Given [initial context], when [event occurs], then [ensure some outcomes]
  22. 22. BDD rethinks testing:   should be written in order of business value should use the standard agile framework of a User story:  "As a [role] I want [feature] so that [benefit]”  should be written with Acceptance criteria in terms of scenarios and implemented as classes:  Given [initial context], when [event occurs], then [ensure some outcomes]
  23. 23. BDD rethinks testing:   should be written in order of business value should use the standard agile framework of a User story:  "As a [role] I want [feature] so that [benefit]”  should be written with Acceptance criteria in terms of scenarios and implemented as classes:  Given [initial context], when [event occurs], then [ensure some outcomes]
  24. 24. BDD rethinks testing:   should be written in order of business value should use the standard agile framework of a User story:  "As a [role] I want [feature] so that [benefit]”  should be written with Acceptance criteria in terms of scenarios and implemented as classes:  Given [initial context], when [event occurs], then [ensure some outcomes]
  25. 25. What is Behat? Behat is a PHP clone of Cucumber (which was written in Ruby). It works with Mink, to….
  26. 26. What is Behat? Behat is a PHP clone of Cucumber (which was written in Ruby). It works with Mink, to…. WHA? Ok, let’s try again….
  27. 27.  Behat tests the behavior of your application described in special language called Gherkin.
  28. 28.  Behat tests the behavior of your application described in special language called Gherkin.  Behat is a clone of a similar tool in Ruby called Cucumber.    Cucumber? Gherkin! Behat?
  29. 29. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a “Business Readable Domain Specific Language” created especially for behavior descriptions. 
  30. 30. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a “Business Readable Domain Specific Language” created especially for behavior descriptions.  Example? Feature: "As a [role] I want [feature] so that [benefit]” Scenario: Given [initial context], when [event occurs], then [ensure some outcomes]
  31. 31. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.   Mink is an open source acceptance test framework for web applications, written in PHP 5.3
  32. 32. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 GoutteDriver SahiDriver ZombieDriver SeleniumDriver Selenium2Driver
  33. 33. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 GoutteDriver SahiDriver ZombieDriver SeleniumDriver Selenium2Driver
  34. 34. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 No Javascript driver SahiDriver ZombieDriver SeleniumDriver Selenium2Driver
  35. 35. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 No Javascript driver Sahi Proxy Driver ZombieDriver SeleniumDriver Selenium2Driver
  36. 36. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 No Javascript driver Sahi Proxy Driver Headless JS Driver SeleniumDriver Selenium2Driver
  37. 37. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 No Javascript driver Sahi Proxy Driver Headless JS Driver Selenium! Driver Selenium2 Driver
  38. 38. Behat tests the behavior of your application described in special language called Gherkin.  Gherkin is a Business Readable, Domain Specific Language created especially for behavior descriptions.        Mink is an open source acceptance test framework for web applications, written in PHP 5.3 No Javascript driver Sahi Proxy Driver Headless JS Driver SeleniumDriver Selenium2Driver
  39. 39. Or how the heck does this work? • Sites we don’t control (blackbox) – Wikipedia demo example • Sites we do control (but still blackbox) – local Drupal 8 install demo example • Whitebox – not demoing today
  40. 40.  Benefits to community  Better testing of all of the code, especially code you didn’t author yourself  Benefits to developer  Write simpler tests and get cleaner tests  improve your code, and your overall site especially with help of non-tech folks  Benefits to end user and site owners  PROFIT! Business focus = productive changes!  Better communication of needs and goals
  41. 41. Modules at Drupal.org:  behat: It allows you to write feature tests for a Drupal site using SimpleTest API functions and assertions in step definitions.  behat_testing: Integrates behat with drush and adds own step definitions for Drupal  drupalextension: Provides a DrupalExtension with Drupal step definitions.  doobie: used to test Drupal.org site w/ behat.
  42. 42.  Why does Drupal.org now use Behat?  Developers don’t get access to the main Drupal boxes…  Breaking Drupal.org is a bad thing!  Updating from D5 to D6 to D7 (to D8…)? Don’t want to lose features, functionality, etc…
  43. 43.  Behat Drupal Group http://groups.drupal.org/behat  Melissa’s articles in Drupal Watchdog  http://drupalwatchdog.com/2/2/behat-mink  Slide shows  http://bdd.alexo.it/slides/dcessen.html  https://portland2013.drupal.org/session/behat- behavioral-driven-development-and-selenium-drupal
  44. 44.  The entire team at BioRAFT and especially  Nathan & Ben, the CEO & CTO who ‘get it’  Jeremy, Justin, Dan, Diliny, & Michelle  Behat coders everywhere and especially  Konstantin Kudryashov (everzet)  Drupal coders everywhere and especially  Melissa Anderson (eliza411)
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×