how to build and maintain quality drupal sites with automated testing

22
Building better websites with automated quality assurance Cheaper, Faster, more Reliable

Upload: acquia

Post on 25-Jan-2015

5.127 views

Category:

Technology


2 download

DESCRIPTION

Automated testing has greatly improved the Drupal core development process. With automated testing over 24,500 unique core patches have been reviewed, and almost 19,000 test assertions are now run against every core patch. The result has been faster development cycle, more stable releases, and the ability to add features more quickly to Drupal core.

TRANSCRIPT

Page 1: How to Build and Maintain Quality Drupal Sites with Automated Testing

Building better websites with automated quality assurance

Cheaper, Faster, more Reliable

Page 2: How to Build and Maintain Quality Drupal Sites with Automated Testing

Agenda

• Introductions• Drupal SimpleTest• Drupal.org usage• Drupal.org Future• Business Value of Quality • Assurance• Examiner Development• Examiner Development -

Selenium• Examiner Benefits

• Testing in the Wild• Contributed Module • Development• Tools for Site Owners• ReviewDriven.com• Contributed Back• Demo

Page 3: How to Build and Maintain Quality Drupal Sites with Automated Testing

Introductions

Jimmy Berry is the lead developer for the automated quality assurance platform used in the Drupal core development process. Jimmy works for Examiner.com where he develops automated quality assurance tools for examiner.com's migration to Drupal 7. Kieran Lal is the project manager for the quality assurance platform. Kieran is the Drupal community adventure guide for Acquia where he helps organizations understand the benefits of Drupal and Acquia's products to be successful with their Drupal sites.

Page 4: How to Build and Maintain Quality Drupal Sites with Automated Testing

Drupal SimpleTest

• Based on SimpleTest.org API

• Provides seemless integration with Drupal

• Extensive Drupal core suiteo Provides many exampleso ~19,000 assertions 

• Introduction - http://drupal.org/simpletest

• Primarily used for "functional" testingo Simulate usero Start from scratch

environment

Page 5: How to Build and Maintain Quality Drupal Sites with Automated Testing

Drupal.org Usage

Number of tests reviewed 24,840

Number of reviews performed 132,773

Average number of times a test is reviewed 5

* http://qa.drupal.org/pifr/statistics

Page 6: How to Build and Maintain Quality Drupal Sites with Automated Testing

Business Value of Quality Assurance

• Confidence to make large changes and refactor as needed.• Can prevent bugs from reoccurring.• Provides the confidence to know the system is ready to

deploy.• Removes the need to for large scale human testing with

every change set.

Page 7: How to Build and Maintain Quality Drupal Sites with Automated Testing

Drupal.org Future

• Drupal 8o Clean code to perfection early in cycle

Combination of manual cleanup and automated tools like the (PHP) Grammar Parser.

o Remove any false positives from Codero Enable Coder review on all patches

• Code coverage reports on commit• Additional automated reviews

o Textual analysiso Security reviews

Page 8: How to Build and Maintain Quality Drupal Sites with Automated Testing

Examiner Development

• On commito Coder reviews - e-mail results to developers

• Dailyo Pre-configured tests against shared dev database

Import clone of dev database. Additional copies made during testing

o Atomic tests that require no database Run against an external server such as production or

staging Ensure that rolled out code is functioning properly Could be used for Drupal.org

Page 9: How to Build and Maintain Quality Drupal Sites with Automated Testing

Examiner Development - Selenium

• Selenium IDEo Workflow

Record test "marcos" Export as PHP Selenium output Convert using simpletest_selenium (d.o project)

o Benefits Distribute test writing workload by allowing non-tech

savy users to record tests Lower initial learning curve requird to include testing

into a development process

Page 10: How to Build and Maintain Quality Drupal Sites with Automated Testing

Examiner Benefits

• Code reviewo Makes it code reviews second natureo Encourages developers to clean up code

• Testingo Lighten manual test loado Still fairly early in development cycle to access benefit

Page 11: How to Build and Maintain Quality Drupal Sites with Automated Testing

Testing in the Wild

• Project Issue File Request (PIFR)o ClassicGraphicso Drupal.orgo Examiner

• Non-PIFRo Consumersearch.como Economist - Hudsono myLifetime - Script

Page 12: How to Build and Maintain Quality Drupal Sites with Automated Testing

Contributed Module Development

• SimpleTest documentation• 365 contributed modules that already have • 46 contributed modules on http://qa.drupal.org • Assistance in writing tests • Infrastructure issues

o Finish info file parsing update* Allow any project maintainer to enable testing Provides mechanism to specify dependency versions

o Interface improvements to enhancing integration Links to related review results Aggregation of summary results on project pages Coverage ratings for projects Project specific filters and settings

http://drupal.org/project/project_issue_file_review http://drupal.org/project/project_issue_file_test* http://drupal.org/node/102102

Page 13: How to Build and Maintain Quality Drupal Sites with Automated Testing

Tools for Site Owners

• SimpleTesto Works with Drupal 6 & 7o Clone of a database

Drupal 6 module - simpletest_clone Drupal 7 patch - node #666956

o Atomic tests – node #758662• PIFR 2

o Automate running of tests and reviewso Used with trigger script or project management

integrationo Works with any combinations of version control systems

Currently supported: bzr, cvs, git, svn

Page 14: How to Build and Maintain Quality Drupal Sites with Automated Testing

ReviewDriven.com

• QA as a serviceo Add site repositoryo Schedule reviewso Define triggerso Configure notifications

• Make QA as easy as possible to improve the Drupal ecosystem as a whole 

• Focus on enhancing tools available to Drupal developers • Public beta coming soon

Page 15: How to Build and Maintain Quality Drupal Sites with Automated Testing

Contributing Back

• Write tests for core• Write tests for contrib and custom modules• Run tests for your modules • Run tests for your site• Run tests for your development process• Write the testing framework

o Drupal.org Project module integration (PIFT)o qa.drupal.org (PIFR)o SimpleTest testing framework

Drupal core 6.x-2.x backport

Page 16: How to Build and Maintain Quality Drupal Sites with Automated Testing

Demo

class DrupalRedesignTestCase extends DrupalStageTestCase { [...]

  protected function setUp() {    $this->stagingUrl = 'http://staging6.drupal.org';    $this->httpauth_credentials = 'drupal:drupal';

    parent::setUp();  }

  protected function testFoo() {    $this->drupalGet('about');    $this->assertText('Documentation');  }}

* http://drupal.org/node/758662

Page 17: How to Build and Maintain Quality Drupal Sites with Automated Testing

QA Sprint Drupalcon SF • Sunday 9AM, April 18th•     Coder Lounge• Learn how to write tests for Drupal core• Learn how to contribute tests to modules you use • Learn how to write tests for your contrib modules• Learn how to run simpletest for your custom site

Page 18: How to Build and Maintain Quality Drupal Sites with Automated Testing

Contributing to the QA project• Add features to the QA platform for core

– E.g. Load testing

• Add features that your consulting company needs for clients

• Add features that your company needs for it’s QA process

• Add features to integrate with your development and test workflow

• Contact: http://qa.drupal.org/contact

Page 19: How to Build and Maintain Quality Drupal Sites with Automated Testing

Appendix

 

Page 20: How to Build and Maintain Quality Drupal Sites with Automated Testing

How to Reach Our Audience

• Developers - front pageo Coder reviewso Involve most popular module developers

• Assemble knowledgeable QA team o [Dave Reid]

• [List of people who have corresponeded]• [List of projects with SimpleTests]• Site owners

o Maintainable benefit that will increase in value Additional plugins and services

Page 21: How to Build and Maintain Quality Drupal Sites with Automated Testing

Schedule for Webinar and Sprint

• Announce Webinar and Sprint on March 22nd• Practice run on the March 25th • Webinar on March 31st• Sprint on April 18th

Page 22: How to Build and Maintain Quality Drupal Sites with Automated Testing

Business Value of Quality Assurance

• Confidence to make large changes and refactor as needed.• Frees developers to focus on features and functionality

instead of ensuring that functionality is not broken.• Helps prevent changes from having a cascade effect.• Can prevent bugs from reoccurring.• Provides the confidence to know the system is ready to

deploy.• Removes the need to for large scale human testing with

every change set.• Provides a consistent mechanism to ensure the system is in

a certain level of stability.• Ensures that testing is not neglected, but instead occurs on

a regular basis.• Provides a way to ensure that configuration changes

specific to one site do not have unwanted effects.