SlideShare a Scribd company logo
1 of 19
Download to read offline
Writing tests in a stylized way
@DrupalBangalore - Date 25 July 2015 www.srijan.net
Ravindra Singh
@ravindrasingh01
Scenario: Successfully authenticating with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
In order to get access to the shopping history
As a frequent buyer I need to be able to authenticate
As a buyer I want to see the shopping history
Requirement:
Feature:
Dev Team
Client
Scenario: Successfully authenticating with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
In order to get access to the shopping history
As a frequent buyer I need to be able to authenticate
As a buyer I want to see the shopping history
Requirement:
Feature:
Dev Team
Client
StoryBDD helps ensuring that development
team has understanding of business on the
same level that client does
Scenario: Successfully authenticating with correct credentials
Given there is a user “everzet” with password “123”
And I am on the login page
When I fill in “username” with “everzet”
And I fill in “password” with “123”
And I press “login”
Then I should see “Hello, everzet”
In order to get access to the shopping history
As a frequent buyer I need to be able to authenticate
As a buyer I want to see the shopping history
Requirement:
Feature:
Dev Team
Client
Agenda
● Introduction to Behat
● Behat Drupal Extension
● Behat Installation/Configuration
● Behat test execution from command line
● A real world example
● How to minimize regressing testing using Behat
What is Behat?
● Welcome to Behat! Behat is a tool that makes behavior
driven development(BDD) possible. With BDD, you write
human-readable stories that describe the behavior of your
application. These stories can then be auto-tested against
your application. And yes, it’s as cool as it sounds!
Drupal Extension
The Drupal Extension to Behat and Mink assists in the
performance of these common Drupal testing tasks:
● Set up test data with Drush or the Drupal API
● Define theme regions and test data appears within them
● Clear the cache, log out, and other useful steps
● Detect and discover steps provided by contributed
modules and themes
● Detail - https://www.drupal.org/project/drupalextension
Installation using Composer
1. Install Composer
2. Install the Drupal Extension in /opt/drupalextension
3. Create an alias to the behat binary in /usr/local/bin
4. Create your test folder
Installation using Composer
Installation using Composer
Installation using Composer
Setup tests
● Create a folder DCB15 where you want to store all test files
for specific projects.
● Create file behat.yml in DCB15
Dry Run
● To ensure everything is set up appropriately, type:
behat -dl
We
Are
Ready
Real world example
Feature: H1 Validations
In order to check H1
As visitor
I need to validate headings are in H1 tag
Scenario: Test the ability to find a heading in a
region
Given I go to "http://d8localdev.me/"
When I click "Create new account"
Then I should see the heading "Create new account"
in the "content" region
Regression Testing
Drupal API Driver
Drush Driver
More info - http://behat-drupal-extension.readthedocs.org/
References
More info - http://behat-drupal-extension.readthedocs.org/
http://behat-drupal-extension.readthedocs.org/
https://github.com/silverstripe-labs/silverstripe-behat-
extension
http://behat.readthedocs.org/en/v2.5/guides/1.gherkin.
html#scenario-outlines
https://www.youtube.com/watch?v=9cYhnTojaHU
http://2015.midcamp.org/session-proposal/automated-testing-
drupal-behat
@ravindrasingh01
Thank You!
Ravindra Singh (@ravindrasingh01)
https://www.drupal.org/u/ravindrasingh

More Related Content

What's hot

Plugging into plugins
Plugging into pluginsPlugging into plugins
Plugging into pluginsJosh Harrison
 
Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?Amanda Giles
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWP Engine UK
 
Optimizing Your Site for Holiday Traffic
Optimizing Your Site for Holiday TrafficOptimizing Your Site for Holiday Traffic
Optimizing Your Site for Holiday TrafficWP Engine UK
 
Coder Presentation
Coder  PresentationCoder  Presentation
Coder PresentationDoug Green
 
Building a Simple Theme Framework
Building a Simple Theme FrameworkBuilding a Simple Theme Framework
Building a Simple Theme FrameworkJoe Casabona
 
Wp snapper review
Wp snapper reviewWp snapper review
Wp snapper reviewDilip Kumar
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web developmentAlberto Apellidos
 
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)Tudor Constantin
 
DrupalCon Barcelona 2015
DrupalCon Barcelona 2015DrupalCon Barcelona 2015
DrupalCon Barcelona 2015Daniel Kanchev
 
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp..."Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...Sudeep Balchhaudi
 
How to Speed Up Your Joomla! Site
How to Speed Up Your Joomla! SiteHow to Speed Up Your Joomla! Site
How to Speed Up Your Joomla! SiteDaniel Kanchev
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Developmentmwrather
 
WDIM268 Week 6 (Summer 2010)
WDIM268 Week 6 (Summer 2010)WDIM268 Week 6 (Summer 2010)
WDIM268 Week 6 (Summer 2010)Tyler Sticka
 
Client-friendly WordPress Websites
Client-friendly WordPress WebsitesClient-friendly WordPress Websites
Client-friendly WordPress WebsitesAaron Rutley
 
Doing More with LESS for CSS
Doing More with LESS for CSSDoing More with LESS for CSS
Doing More with LESS for CSSTodd Anglin
 

What's hot (20)

Plugging into plugins
Plugging into pluginsPlugging into plugins
Plugging into plugins
 
Automation Like A Pro
Automation Like A ProAutomation Like A Pro
Automation Like A Pro
 
Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?Shortcodes vs Widgets: Which one and how?
Shortcodes vs Widgets: Which one and how?
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
Optimizing Your Site for Holiday Traffic
Optimizing Your Site for Holiday TrafficOptimizing Your Site for Holiday Traffic
Optimizing Your Site for Holiday Traffic
 
Coder Presentation
Coder  PresentationCoder  Presentation
Coder Presentation
 
Building a Simple Theme Framework
Building a Simple Theme FrameworkBuilding a Simple Theme Framework
Building a Simple Theme Framework
 
Wp snapper review
Wp snapper reviewWp snapper review
Wp snapper review
 
Begin scripting
Begin scriptingBegin scripting
Begin scripting
 
Java script basic
Java script basicJava script basic
Java script basic
 
Introduction to web development
Introduction to web developmentIntroduction to web development
Introduction to web development
 
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
 
DrupalCon Barcelona 2015
DrupalCon Barcelona 2015DrupalCon Barcelona 2015
DrupalCon Barcelona 2015
 
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp..."Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
"Ensuring chances of theme acceptance in wordpress.org directory" on WordCamp...
 
Wordpress Shortcode
Wordpress ShortcodeWordpress Shortcode
Wordpress Shortcode
 
How to Speed Up Your Joomla! Site
How to Speed Up Your Joomla! SiteHow to Speed Up Your Joomla! Site
How to Speed Up Your Joomla! Site
 
Modern Front-End Development
Modern Front-End DevelopmentModern Front-End Development
Modern Front-End Development
 
WDIM268 Week 6 (Summer 2010)
WDIM268 Week 6 (Summer 2010)WDIM268 Week 6 (Summer 2010)
WDIM268 Week 6 (Summer 2010)
 
Client-friendly WordPress Websites
Client-friendly WordPress WebsitesClient-friendly WordPress Websites
Client-friendly WordPress Websites
 
Doing More with LESS for CSS
Doing More with LESS for CSSDoing More with LESS for CSS
Doing More with LESS for CSS
 

Viewers also liked

Γνωρίστε το Drupal
Γνωρίστε το DrupalΓνωρίστε το Drupal
Γνωρίστε το DrupalDespina Kamilali
 
Η εξέλιξη του διδακτορικού μου
Η εξέλιξη του διδακτορικού μουΗ εξέλιξη του διδακτορικού μου
Η εξέλιξη του διδακτορικού μουDespina Kamilali
 
Drupal Developer Open Badge από το OpenEducation.GR
Drupal Developer Open Badge από το OpenEducation.GRDrupal Developer Open Badge από το OpenEducation.GR
Drupal Developer Open Badge από το OpenEducation.GRDespina Kamilali
 
Δημιουργία Ιστοσελίδων
Δημιουργία ΙστοσελίδωνΔημιουργία Ιστοσελίδων
Δημιουργία ΙστοσελίδωνDespina Kamilali
 
MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.
MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.
MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.Despina Kamilali
 
Custom Android App Development – Web Animation India
Custom Android App Development – Web Animation IndiaCustom Android App Development – Web Animation India
Custom Android App Development – Web Animation IndiaMarion Welch
 

Viewers also liked (7)

Γνωρίστε το Drupal
Γνωρίστε το DrupalΓνωρίστε το Drupal
Γνωρίστε το Drupal
 
Η εξέλιξη του διδακτορικού μου
Η εξέλιξη του διδακτορικού μουΗ εξέλιξη του διδακτορικού μου
Η εξέλιξη του διδακτορικού μου
 
Drupal Developer Open Badge από το OpenEducation.GR
Drupal Developer Open Badge από το OpenEducation.GRDrupal Developer Open Badge από το OpenEducation.GR
Drupal Developer Open Badge από το OpenEducation.GR
 
Δημιουργία Ιστοσελίδων
Δημιουργία ΙστοσελίδωνΔημιουργία Ιστοσελίδων
Δημιουργία Ιστοσελίδων
 
MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.
MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.
MOOCs: Ιστορικά και Στατιστικά Στοιχεία - Διδακτικός σχεδιασμός.
 
SFA Sales Reporting Software for Key Performance Indicators
SFA Sales Reporting Software for Key Performance IndicatorsSFA Sales Reporting Software for Key Performance Indicators
SFA Sales Reporting Software for Key Performance Indicators
 
Custom Android App Development – Web Animation India
Custom Android App Development – Web Animation IndiaCustom Android App Development – Web Animation India
Custom Android App Development – Web Animation India
 

Similar to Behat for writing tests in a stylized way

Enabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projectsEnabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projectsKonstantin Kudryashov
 
Ruby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybaraRuby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybaraBindesh Vijayan
 
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
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018Berend de Boer
 
[drupalday2017] - Behat per Drupal: test automatici e molto di più
[drupalday2017] - Behat per Drupal: test automatici e molto di più[drupalday2017] - Behat per Drupal: test automatici e molto di più
[drupalday2017] - Behat per Drupal: test automatici e molto di piùDrupalDay
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testingnyccamp
 
Panther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersLes-Tilleuls.coop
 
BDD with CucumberJS and WebdriverIO
BDD with CucumberJS and WebdriverIOBDD with CucumberJS and WebdriverIO
BDD with CucumberJS and WebdriverIOM Rizwanur Rashid
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentEvan Mullins
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenarioArnauld Loyer
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressRami Sayar
 
TDD - for people who don't need it
TDD - for people who don't need itTDD - for people who don't need it
TDD - for people who don't need itChoon Keat Chew
 
Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Barry Kooij
 
BDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User StoriesBDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User StoriesSauce Labs
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David TorroijaDavid Torroija
 

Similar to Behat for writing tests in a stylized way (20)

Cucumber_Training_ForQA
Cucumber_Training_ForQACucumber_Training_ForQA
Cucumber_Training_ForQA
 
Enabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projectsEnabling agile devliery through enabling BDD in PHP projects
Enabling agile devliery through enabling BDD in PHP projects
 
Ruby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybaraRuby onrails cucumber-rspec-capybara
Ruby onrails cucumber-rspec-capybara
 
BDD, Behat & Drupal
BDD, Behat & DrupalBDD, Behat & Drupal
BDD, Behat & Drupal
 
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)
 
Behat - Drupal South 2018
Behat  - Drupal South 2018Behat  - Drupal South 2018
Behat - Drupal South 2018
 
[drupalday2017] - Behat per Drupal: test automatici e molto di più
[drupalday2017] - Behat per Drupal: test automatici e molto di più[drupalday2017] - Behat per Drupal: test automatici e molto di più
[drupalday2017] - Behat per Drupal: test automatici e molto di più
 
Behat - human-readable automated testing
Behat - human-readable automated testingBehat - human-readable automated testing
Behat - human-readable automated testing
 
Panther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsersPanther: test your Symfony apps with real web browsers
Panther: test your Symfony apps with real web browsers
 
BDD with CucumberJS and WebdriverIO
BDD with CucumberJS and WebdriverIOBDD with CucumberJS and WebdriverIO
BDD with CucumberJS and WebdriverIO
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
 
BDD - Writing better scenario
BDD - Writing better scenarioBDD - Writing better scenario
BDD - Writing better scenario
 
Automation in Drupal
Automation in DrupalAutomation in Drupal
Automation in Drupal
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPress
 
TDD - for people who don't need it
TDD - for people who don't need itTDD - for people who don't need it
TDD - for people who don't need it
 
Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014Plugin Development @ WordCamp Norway 2014
Plugin Development @ WordCamp Norway 2014
 
Django Girls Tutorial
Django Girls TutorialDjango Girls Tutorial
Django Girls Tutorial
 
BDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User StoriesBDD Selenium for Agile Teams - User Stories
BDD Selenium for Agile Teams - User Stories
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 

Recently uploaded (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 

Behat for writing tests in a stylized way

  • 1. Writing tests in a stylized way @DrupalBangalore - Date 25 July 2015 www.srijan.net Ravindra Singh @ravindrasingh01
  • 2. Scenario: Successfully authenticating with correct credentials Given there is a user “everzet” with password “123” And I am on the login page When I fill in “username” with “everzet” And I fill in “password” with “123” And I press “login” Then I should see “Hello, everzet” In order to get access to the shopping history As a frequent buyer I need to be able to authenticate As a buyer I want to see the shopping history Requirement: Feature: Dev Team Client
  • 3. Scenario: Successfully authenticating with correct credentials Given there is a user “everzet” with password “123” And I am on the login page When I fill in “username” with “everzet” And I fill in “password” with “123” And I press “login” Then I should see “Hello, everzet” In order to get access to the shopping history As a frequent buyer I need to be able to authenticate As a buyer I want to see the shopping history Requirement: Feature: Dev Team Client StoryBDD helps ensuring that development team has understanding of business on the same level that client does
  • 4. Scenario: Successfully authenticating with correct credentials Given there is a user “everzet” with password “123” And I am on the login page When I fill in “username” with “everzet” And I fill in “password” with “123” And I press “login” Then I should see “Hello, everzet” In order to get access to the shopping history As a frequent buyer I need to be able to authenticate As a buyer I want to see the shopping history Requirement: Feature: Dev Team Client
  • 5. Agenda ● Introduction to Behat ● Behat Drupal Extension ● Behat Installation/Configuration ● Behat test execution from command line ● A real world example ● How to minimize regressing testing using Behat
  • 6. What is Behat? ● Welcome to Behat! Behat is a tool that makes behavior driven development(BDD) possible. With BDD, you write human-readable stories that describe the behavior of your application. These stories can then be auto-tested against your application. And yes, it’s as cool as it sounds!
  • 7. Drupal Extension The Drupal Extension to Behat and Mink assists in the performance of these common Drupal testing tasks: ● Set up test data with Drush or the Drupal API ● Define theme regions and test data appears within them ● Clear the cache, log out, and other useful steps ● Detect and discover steps provided by contributed modules and themes ● Detail - https://www.drupal.org/project/drupalextension
  • 8. Installation using Composer 1. Install Composer 2. Install the Drupal Extension in /opt/drupalextension 3. Create an alias to the behat binary in /usr/local/bin 4. Create your test folder
  • 12. Setup tests ● Create a folder DCB15 where you want to store all test files for specific projects. ● Create file behat.yml in DCB15
  • 13. Dry Run ● To ensure everything is set up appropriately, type: behat -dl
  • 15. Real world example Feature: H1 Validations In order to check H1 As visitor I need to validate headings are in H1 tag Scenario: Test the ability to find a heading in a region Given I go to "http://d8localdev.me/" When I click "Create new account" Then I should see the heading "Create new account" in the "content" region
  • 17. Drupal API Driver Drush Driver More info - http://behat-drupal-extension.readthedocs.org/
  • 18. References More info - http://behat-drupal-extension.readthedocs.org/ http://behat-drupal-extension.readthedocs.org/ https://github.com/silverstripe-labs/silverstripe-behat- extension http://behat.readthedocs.org/en/v2.5/guides/1.gherkin. html#scenario-outlines https://www.youtube.com/watch?v=9cYhnTojaHU http://2015.midcamp.org/session-proposal/automated-testing- drupal-behat
  • 19. @ravindrasingh01 Thank You! Ravindra Singh (@ravindrasingh01) https://www.drupal.org/u/ravindrasingh