Automated testing DrupalCamp in Asheville
Upcoming SlideShare
Loading in...5

Automated testing DrupalCamp in Asheville






Total Views
Slideshare-icon Views on SlideShare
Embed Views



1 Embed 76 76



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    Automated testing DrupalCamp in Asheville Automated testing DrupalCamp in Asheville Presentation Transcript

    • Automated Testing
    • 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
    • ABOUT JOHNNIE: • Presenter • Johnnie Fox • @johnniefox • Promet Source • Director of Development • Scrum Master • Project Manager • Recovering Developer • @prometsource
    • ABOUT CHRIS • PresenterInsert picture of Chris • Chris Calip • Promet Source • Application Developer • @prometsource
    • 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)
    • 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 - ://
    • 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
    • HACKATHON OBJECTIVE:Develop, deploy, demonstrate, and identify challenges ofmaking using ci infrastructure to implement acceptancetests (unit tests, selenium) on one existing site.
    • TECHNICAL DETAILS code metrics user acceptance provisions servers with testing componentsadmin gui to trigger testsuites, or view reports
    • Necessary components• For necessary components and installation instructions, go to:• Phing Drupal Template•• Jenkins Drupal Template•• Phing Drupal Template with User Acceptance Test•• In addition for phing-drupal-template with user acceptance test, you need to install additional pear libraries • For more instructions,
    • Installing InfrastructureInitial assumption: your server has several initial softwarealready1. Go to 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
    • 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
    • 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
    • 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••• 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
    • EXAMPLE TEST SUITE FOR DEVELOPMENT SITES Guiding principle: Fast Iteration
    • Traditional Dev Staging Production and Workflow Manual Manual Manual Local Dev Staging Production Lots of commits Significant Event (Less Frequent)
    • 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
    • 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)
    • All those test eats up server resources ... .
    • Drupal ANATOMY OF USER ACCEPTANCE Sites TEST 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 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)
    • Example Jenkins Dashboard
    • Example of Code Metric TestPHP Mess Detector
    • GIT POST HOOK TRIGGERING THE TEST SUITE. writes the code & test Client updates database • Finding a block with Selenium • Dev pushes code
    • Questions? Twitter: @prometsource