SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
» Wordcamp 2011 DJCP Speaks!                 http://presentations.collispuro.com/?slideshows=...




          Behavior Driven Development and
          WordPress plugins

                                 Dan Collis-Puro

                               dan@collispuro.com

                                     @djcp



                          Wordcamp Boston, 2011




1 of 10                                                                   07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!              http://presentations.collispuro.com/?slideshows=...




          Intro to BDD

              Logical successor to TDD

              “Outside in”

              Delivers more business value (theoretically)

              Uses “stories” to describe behavior and create
            testing scenarios.

             PHP alternatives to ruby’s cucumber and capybara –
            behat




2 of 10                                                                07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!               http://presentations.collispuro.com/?slideshows=...




          Why?
              Beats me!

              Quality.

              Obligatory pithy statements: “testing is free
            insurance” ”I don’t always test, but when I do it’s in
            production”

             Assurance that changes you make don’t break
            anything else.

             General utility – an automatable browser that can
            REALLY render HTML and javascript.




3 of 10                                                                 07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!               http://presentations.collispuro.com/?slideshows=...




          Intro to cucumber, capybara and
          selenium

             cucumber is the framework that allows for the
            execution of plain-text stories as automated tests.

             capybara use a driver (in my case, selenium) to
            execute these tests.

              selenium interfaces with a browser to execute tests.

          The secret sauce:
              None of this is language or location specific!




4 of 10                                                                 07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!                      http://presentations.collispuro.com/?slideshows=...




          Sample Stories
            Feature: Allow administrators to activate and manage the plugin options.
            Scenario: Activate the plugin without errors.
                Given a "Deactivated" plugin in the row with the id "your-plugin"
                And a logged in user of type "administrator"
                When I visit "/wp-admin/plugins.php"
                And I click "Activate" within the row with the id "your-plugin"
                Then I should see "Plugin activated"




            Scenario: Manage options for the plugin
                Given a "Activated" plugin in the row with the id "fathom-presentations-for-word
                And a logged in user of type "administrator"
                When I visit "/wp-admin/options-general.php?page=fathom-config"
                And I fill in "fathom_height" with "650"
                And I fill in "fathom_width" with "900"
                And I check "fathom_vertical_center"
                And I press "Update Options"
                Then I should see "Saved options."
                And I should see "Slideshow Height"
                And I should see "Slideshow Width"
                And the "fathom_height" field should contain "650"
                And the "fathom_width" field should contain "900"
                And the checkbox "fathom_vertical_center" should be checked




5 of 10                                                                        07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!                      http://presentations.collispuro.com/?slideshows=...




          Installation

              Don’t panic!

              Assuming linux. Absolutely works on osx.

              Install ruby – easiest via rvm, methinks.

            apt-get install build-essential firefox sun-java6-bin sun-java6-jdk sun-java6-jre 
              libxslt1-dev libxml2-dev libxml2 libxslt1.1
            rvm gemset create cucumber #container to hold gems we need for cucumber
            rvm gemset use cucumber #switch into gemset
            gem install bundler #get bundler, the gem dependency manager
            bundle install




6 of 10                                                                        07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!                 http://presentations.collispuro.com/?slideshows=...




          Running features



            cucumber --guess -tag @yourtag
            cucumber --guess




              Look at the colors!




7 of 10                                                                   07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!               http://presentations.collispuro.com/?slideshows=...




          BDD workflow

            1. Write your feature and populate it with scenarios.
            Tag it with (traditionally “@wip“) so you can isolate
            running it.

            2. Run the feature. Oh noes, red!

            3. (optional) Create whatever step definitions you
            need to satisfy the steps in the scenario.

            4. Write the code to satisfy the scenario.

            5. red, green, repeat until the money runs out.




8 of 10                                                                 07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!              http://presentations.collispuro.com/?slideshows=...




          Final thoughts
              cucumber/gherkin/selenium allow for very flexible,
            expressive, and reusable browser automation and
            testing.

              Can point at ANYTHING.

          The Future?
              Create a generic framework for BDD development

              Challenges – software and meatware engineering.

              Imagine if every plugin / theme in your stack had a
            testing suite




9 of 10                                                                07/25/2011 10:27 PM
» Wordcamp 2011 DJCP Speaks!               http://presentations.collispuro.com/?slideshows=...




           Thx
              @djcp

              dan@collispuro.com , djcp@cyber.law.harvard.edu

              Stuff will be posted to relevant places.

           Links
              cucumber – http://cukes.info/

              rvm – http://rvm.beginrescueend.com/

              behat – http://behat.org/

              selenium – http://seleniumhq.org/




10 of 10                                                                07/25/2011 10:27 PM

Contenu connexe

Similaire à BDD WordPress Plugins with Cucumber

Go With The Reflow
Go With The ReflowGo With The Reflow
Go With The Reflowlsimon
 
DevOps Hiring
DevOps HiringDevOps Hiring
DevOps Hiringkshep
 
The FT Web App: Coding Responsively
The FT Web App: Coding ResponsivelyThe FT Web App: Coding Responsively
The FT Web App: Coding ResponsivelyC4Media
 
Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Balanced Team
 
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...Marco Cedaro
 
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...Marco Cedaro
 
Plone Futures, Plone Conference 2016 Keynote by Eric Steele
Plone Futures, Plone Conference 2016 Keynote by Eric SteelePlone Futures, Plone Conference 2016 Keynote by Eric Steele
Plone Futures, Plone Conference 2016 Keynote by Eric SteeleT. Kim Nguyen
 
Into the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional ProgrammingInto the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional ProgrammingMike Pence
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Edureka!
 
Developing in production
Developing in productionDeveloping in production
Developing in productionDamien PLARD
 
Devops kc meetup_5_20_2013
Devops kc meetup_5_20_2013Devops kc meetup_5_20_2013
Devops kc meetup_5_20_2013Aaron Blythe
 
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in ActionBill Scott
 
DevOps Columbus Meetup Kickoff - Infrastructure as Code
DevOps Columbus Meetup Kickoff - Infrastructure as CodeDevOps Columbus Meetup Kickoff - Infrastructure as Code
DevOps Columbus Meetup Kickoff - Infrastructure as CodeMichael Ducy
 
Lean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerLean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerBill Scott
 
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?André Goliath
 
StackEngine Problem Space Demo
StackEngine Problem Space DemoStackEngine Problem Space Demo
StackEngine Problem Space DemoBoyd Hemphill
 
BathCamp #32 - CMS Smackdown! - Plone
BathCamp #32 - CMS Smackdown! - PloneBathCamp #32 - CMS Smackdown! - Plone
BathCamp #32 - CMS Smackdown! - PloneMatt Hamilton
 
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
ITKonekt 2023: The Busy Platform Engineers Guide to API GatewaysITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
ITKonekt 2023: The Busy Platform Engineers Guide to API GatewaysDaniel Bryant
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAsko Soukka
 

Similaire à BDD WordPress Plugins with Cucumber (20)

Go With The Reflow
Go With The ReflowGo With The Reflow
Go With The Reflow
 
DevOps Hiring
DevOps HiringDevOps Hiring
DevOps Hiring
 
The FT Web App: Coding Responsively
The FT Web App: Coding ResponsivelyThe FT Web App: Coding Responsively
The FT Web App: Coding Responsively
 
Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...
 
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
JsDay - It's not you, It's me (or how to avoid being coupled with a Javascrip...
 
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javasc...
 
Plone Futures, Plone Conference 2016 Keynote by Eric Steele
Plone Futures, Plone Conference 2016 Keynote by Eric SteelePlone Futures, Plone Conference 2016 Keynote by Eric Steele
Plone Futures, Plone Conference 2016 Keynote by Eric Steele
 
Plone Futures
Plone FuturesPlone Futures
Plone Futures
 
Into the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional ProgrammingInto the Land of lambda, One Programmer's Journey Into Functional Programming
Into the Land of lambda, One Programmer's Journey Into Functional Programming
 
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
Chef vs Puppet vs Ansible vs SaltStack | Configuration Management Tools Compa...
 
Developing in production
Developing in productionDeveloping in production
Developing in production
 
Devops kc meetup_5_20_2013
Devops kc meetup_5_20_2013Devops kc meetup_5_20_2013
Devops kc meetup_5_20_2013
 
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
 
DevOps Columbus Meetup Kickoff - Infrastructure as Code
DevOps Columbus Meetup Kickoff - Infrastructure as CodeDevOps Columbus Meetup Kickoff - Infrastructure as Code
DevOps Columbus Meetup Kickoff - Infrastructure as Code
 
Lean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerLean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partner
 
Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
 
StackEngine Problem Space Demo
StackEngine Problem Space DemoStackEngine Problem Space Demo
StackEngine Problem Space Demo
 
BathCamp #32 - CMS Smackdown! - Plone
BathCamp #32 - CMS Smackdown! - PloneBathCamp #32 - CMS Smackdown! - Plone
BathCamp #32 - CMS Smackdown! - Plone
 
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
ITKonekt 2023: The Busy Platform Engineers Guide to API GatewaysITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
ITKonekt 2023: The Busy Platform Engineers Guide to API Gateways
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 

Dernier

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 

Dernier (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

BDD WordPress Plugins with Cucumber

  • 1. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Behavior Driven Development and WordPress plugins Dan Collis-Puro dan@collispuro.com @djcp Wordcamp Boston, 2011 1 of 10 07/25/2011 10:27 PM
  • 2. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Intro to BDD Logical successor to TDD “Outside in” Delivers more business value (theoretically) Uses “stories” to describe behavior and create testing scenarios. PHP alternatives to ruby’s cucumber and capybara – behat 2 of 10 07/25/2011 10:27 PM
  • 3. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Why? Beats me! Quality. Obligatory pithy statements: “testing is free insurance” ”I don’t always test, but when I do it’s in production” Assurance that changes you make don’t break anything else. General utility – an automatable browser that can REALLY render HTML and javascript. 3 of 10 07/25/2011 10:27 PM
  • 4. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Intro to cucumber, capybara and selenium cucumber is the framework that allows for the execution of plain-text stories as automated tests. capybara use a driver (in my case, selenium) to execute these tests. selenium interfaces with a browser to execute tests. The secret sauce: None of this is language or location specific! 4 of 10 07/25/2011 10:27 PM
  • 5. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Sample Stories Feature: Allow administrators to activate and manage the plugin options. Scenario: Activate the plugin without errors. Given a "Deactivated" plugin in the row with the id "your-plugin" And a logged in user of type "administrator" When I visit "/wp-admin/plugins.php" And I click "Activate" within the row with the id "your-plugin" Then I should see "Plugin activated" Scenario: Manage options for the plugin Given a "Activated" plugin in the row with the id "fathom-presentations-for-word And a logged in user of type "administrator" When I visit "/wp-admin/options-general.php?page=fathom-config" And I fill in "fathom_height" with "650" And I fill in "fathom_width" with "900" And I check "fathom_vertical_center" And I press "Update Options" Then I should see "Saved options." And I should see "Slideshow Height" And I should see "Slideshow Width" And the "fathom_height" field should contain "650" And the "fathom_width" field should contain "900" And the checkbox "fathom_vertical_center" should be checked 5 of 10 07/25/2011 10:27 PM
  • 6. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Installation Don’t panic! Assuming linux. Absolutely works on osx. Install ruby – easiest via rvm, methinks. apt-get install build-essential firefox sun-java6-bin sun-java6-jdk sun-java6-jre libxslt1-dev libxml2-dev libxml2 libxslt1.1 rvm gemset create cucumber #container to hold gems we need for cucumber rvm gemset use cucumber #switch into gemset gem install bundler #get bundler, the gem dependency manager bundle install 6 of 10 07/25/2011 10:27 PM
  • 7. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Running features cucumber --guess -tag @yourtag cucumber --guess Look at the colors! 7 of 10 07/25/2011 10:27 PM
  • 8. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... BDD workflow 1. Write your feature and populate it with scenarios. Tag it with (traditionally “@wip“) so you can isolate running it. 2. Run the feature. Oh noes, red! 3. (optional) Create whatever step definitions you need to satisfy the steps in the scenario. 4. Write the code to satisfy the scenario. 5. red, green, repeat until the money runs out. 8 of 10 07/25/2011 10:27 PM
  • 9. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Final thoughts cucumber/gherkin/selenium allow for very flexible, expressive, and reusable browser automation and testing. Can point at ANYTHING. The Future? Create a generic framework for BDD development Challenges – software and meatware engineering. Imagine if every plugin / theme in your stack had a testing suite 9 of 10 07/25/2011 10:27 PM
  • 10. » Wordcamp 2011 DJCP Speaks! http://presentations.collispuro.com/?slideshows=... Thx @djcp dan@collispuro.com , djcp@cyber.law.harvard.edu Stuff will be posted to relevant places. Links cucumber – http://cukes.info/ rvm – http://rvm.beginrescueend.com/ behat – http://behat.org/ selenium – http://seleniumhq.org/ 10 of 10 07/25/2011 10:27 PM