Automated Testing
About PrometMission Statement: “Promet Solutions specializes indeveloping innovative, complex web applications with openso...
ABOUT JOHNNIE:                 •   Presenter                     •   Johnnie Fox                     •   @johnniefox      ...
ABOUT CHRIS                          •   PresenterInsert picture of Chris                              •   Chris Calip    ...
HISTORY OF DRUPAL TESTING Drupal Testing: D6 core – Simpletest Application specific testing - Manual Tests - Written test ...
CONTINUOUS INTEGRATION:Continuous Integration (CI) implements continuous processes of applyingquality control — small piec...
HACKATHON TEAM :    Five. Striving as one. Driven by a passion for continuous automated quality control.   Ruoran Wang   S...
HACKATHON OBJECTIVE:Develop, deploy, demonstrate, and identify challenges ofmaking using ci infrastructure to implement ac...
TECHNICAL DETAILS                              code metrics                            phpqatools.org                     ...
Necessary components• For necessary components and installation instructions,  go to:• Phing Drupal Template• http://reloa...
Installing InfrastructureInitial assumption: your server has several initial softwarealready1. Go to https://github.com/pr...
EXAMPLE TEST SUITE FOR SITE SUPPORT
Jenkins:Scheduled 1AM User                     Jenkins: Clone  Acceptance Test                Production to Test          ...
What is Selenium? •Selenium automates browsers. Thats it. What you do with that power  is entirely up to you. Primarily it...
Functional Test PHPUnit• Project Airbox   • Checkout process that involves passing customer information to third party    ...
EXAMPLE TEST SUITE FOR DEVELOPMENT SITES                   Guiding principle: Fast Iteration
Traditional Dev Staging Production and Workflow           Manual             Manual             Manual   Local            ...
Dev Staging Production Work Flowwith Automated ContinuousIntegration Tests                       Manual                   ...
Manual TestJenkins: Clone Staging DB to test DB (5 mins)Jenkins: Run code-metrics test (10-15 mins)Jenkins: Run user accep...
All those test eats up server resources ...   .
Drupal                                     ANATOMY OF USER ACCEPTANCE                  Sites              TEST            ...
Example Jenkins Dashboard
Example of Code Metric TestPHP Mess Detector
EXAMPLE OF PHPUNIT REPORT
GIT POST HOOK TRIGGERING THE TEST SUITE.http://demosource.prometdev.com/blogDev writes the code & test             Client ...
Questions?www.prometsource.com       chriscalip@prometsource.com        johnnie@prometsource.com            Twitter: @prom...
Upcoming SlideShare
Loading in …5
×

Automated testing DrupalCamp in Asheville

1,698 views

Published on

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

No Downloads
Views
Total views
1,698
On SlideShare
0
From Embeds
0
Number of Embeds
207
Actions
Shares
0
Downloads
12
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Automated testing DrupalCamp in Asheville

  1. 1. Automated Testing
  2. 2. About PrometMission Statement: “Promet Solutions specializes indeveloping innovative, complex web applications with opensource technology.”30+ solutions architects 10 year in business thworldwide 32 open source contributions • Offices in the US • Chicago 10+ mobile apps in the past 12 months • San Jose
  3. 3. ABOUT JOHNNIE: • Presenter • Johnnie Fox • @johnniefox • Promet Source • Director of Development • Scrum Master • Project Manager • Recovering Developer • @prometsource
  4. 4. ABOUT CHRIS • PresenterInsert picture of Chris • Chris Calip • Promet Source • Application Developer • @prometsource
  5. 5. HISTORY OF DRUPAL TESTING Drupal Testing: D6 core – Simpletest Application specific testing - Manual Tests - Written test cases – Word documents - The spreadsheet of pain. (Checklist)Challenges - Testing different browsers Reproducible results Providing a record Doesn’t test integration with 3rd party API (backend functionality)
  6. 6. CONTINUOUS INTEGRATION:Continuous Integration (CI) implements continuous processes of applyingquality control — small pieces of effort, applied frequently. Continuousintegration aims to improve the quality of software, and to reduce the timetaken to deliver it, by replacing the traditional practice of applying quality controlafter completing all development.Continuous Integration emerged in the Extreme Programming (XP) community,and XP advocates Martin Fowler and Kent Beck first wrote about continuousintegration circa 1999. Continuous integration - Wikipedia, the free encyclopedia : taken from - http://en.wikipedia.org/wiki/Continuous_integrationhttp ://creativecommons.org/licenses/by-sa/3.0/
  7. 7. HACKATHON TEAM : Five. Striving as one. Driven by a passion for continuous automated quality control. Ruoran Wang Scott Massey Chris Calip Johnnie Fox Michelle Krejci
  8. 8. HACKATHON OBJECTIVE:Develop, deploy, demonstrate, and identify challenges ofmaking using ci infrastructure to implement acceptancetests (unit tests, selenium) on one existing site.
  9. 9. TECHNICAL DETAILS code metrics phpqatools.org user acceptance provisions servers with testing componentsadmin gui to trigger testsuites, or view reports
  10. 10. Necessary components• For necessary components and installation instructions, go to:• Phing Drupal Template• http://reload.github.com/phing-drupal-template/• Jenkins Drupal Template• http://reload.github.com/jenkins-drupal-template• Phing Drupal Template with User Acceptance Test• http://github.com/promet/phing-drupal-template• In addition for phing-drupal-template with user acceptance test, you need to install additional pear libraries • For more instructions, http://phpqatools.org/
  11. 11. Installing InfrastructureInitial assumption: your server has several initial softwarealready1. Go to https://github.com/promet/phing-drupal-template2. Three files that you need to use to install infrastructure3. Put in on your site Drupal root4. If you want to override it, build.properties5. Customize variables
  12. 12. EXAMPLE TEST SUITE FOR SITE SUPPORT
  13. 13. Jenkins:Scheduled 1AM User Jenkins: Clone Acceptance Test Production to Test PHING: PHPUnit Configuration Load Jenkins & PHING: User With Bootstrap and PHING: Selenium Acceptance PHPUnit + what Bootstrap file Without Config Upload Selenium (ability to use Bootstrap Drupal API)PHING: Autodiscover PHING: Report PHING: Autodiscover the Selenium test Generated the PHPUnit test PHING: Trigger each Jenkins: If errors PHING: Trigger each found, notify PHPUnit Test and Selenium test and stakeholders generate report generate report Done
  14. 14. What is Selenium? •Selenium automates browsers. Thats it. What you do with that power is entirely up to you. Primarily it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web- based administration tasks can (and should!) also be automated as well. •Selenium has the support of some of the largest browser vendors who have taken (or are taking) steps to make Selenium a native part of their browser. It is also the core technology in countless other browser automation tools, APIs and frameworks.• Goes through every page • Makes sure header, footer, logos, etc • All branding elements in place
  15. 15. Functional Test PHPUnit• Project Airbox • Checkout process that involves passing customer information to third party banking API, passes back customer ID • Months after completion, API changes broke the application • PHPUnit figures out how and where the problem is • More importantly, is there a problem?• Major time saver for detective work• -- bootstrap option to make use of forked upal without SUT• https://github.com/chriscalip/upal• http://drupal.org/node/1567500• actually installs a complete Drupal site like the regular Drupal installer for every test being executed, using a random database prefix and some logic baked into Drupals (regular runtime) core that re-routes all HTTP requests originating from WebTestBase into the "child site under test" (the db-prefixed one). Based on that, every test is able to specify additional modules to install into that child site, in order to test various
  16. 16. EXAMPLE TEST SUITE FOR DEVELOPMENT SITES Guiding principle: Fast Iteration
  17. 17. Traditional Dev Staging Production and Workflow Manual Manual Manual Local Dev Staging Production Lots of commits Significant Event (Less Frequent)
  18. 18. Dev Staging Production Work Flowwith Automated ContinuousIntegration Tests Manual Manual Manual TestLocal Dev Staging Production Branch Automatic push if Run Test passes Suite Jenkins: Clone Staging DB to test DB Jenkins: Run code-metrics test Jenkins: Run user acceptance test Jenkins: Run Drupal Core and Contribution Simple test
  19. 19. Manual TestJenkins: Clone Staging DB to test DB (5 mins)Jenkins: Run code-metrics test (10-15 mins)Jenkins: Run user acceptance test (10-15 mins)Jenkins: Run Drupal Core and Contribution Simple test (Needs work)Jenkins: RUN ALL (35 mins)
  20. 20. All those test eats up server resources ... .
  21. 21. Drupal ANATOMY OF USER ACCEPTANCE Sites TEST build.properties project.code.custom = All bathroom conference_room Modules# Chosen File Pattern by project for phpunit ie.. ExampleUnitTest.php bathroomSampleUnitTest.php bathroomUnitTest.phpproject.phpunit.filepattern = UnitTest.php bathroomSeleniumTest.ph p# Selenium conference room# Chosen File Pattern by project for selenium ie.. conferenceroomUnitTest.phExampleSeleniumTest.php SampleSeleniumTest.php pproject.selenium.filepattern = SeleniumTest.php conferenceroomSeleniumTest. php Kitchen (Contrib)
  22. 22. Example Jenkins Dashboard
  23. 23. Example of Code Metric TestPHP Mess Detector
  24. 24. EXAMPLE OF PHPUNIT REPORT
  25. 25. GIT POST HOOK TRIGGERING THE TEST SUITE.http://demosource.prometdev.com/blogDev writes the code & test Client updates database • Finding a block with Selenium • Dev pushes code
  26. 26. Questions?www.prometsource.com chriscalip@prometsource.com johnnie@prometsource.com Twitter: @prometsource

×