17

Click here to load reader

Drupal and testing (2010 - 2011 / 2)

Embed Size (px)

DESCRIPTION

How to test in Drupal. Short and brief presentation.

Citation preview

Page 1: Drupal and testing (2010 - 2011 / 2)

Testing

In Drupal

Page 2: Drupal and testing (2010 - 2011 / 2)
Page 3: Drupal and testing (2010 - 2011 / 2)

Reasons of testing

● Find bugs● Semantics (not for syntax)● Function● Class● API● Service

● Ensure workflow – user stories● Make less work for us ;)

Page 4: Drupal and testing (2010 - 2011 / 2)

Goodies

● Automation● Speed (code, grid)● Triggered tests (Hudson)● Bug → solution → test● TDD● Safer refactoring

Page 5: Drupal and testing (2010 - 2011 / 2)

Types

● Unit● Functional● Ad-hoc

Page 6: Drupal and testing (2010 - 2011 / 2)

Ad-hoc

● On demand● Random● Unreliable

Page 7: Drupal and testing (2010 - 2011 / 2)

Unit test

● Checks● Code● Behavior● Integrity

● Elements● SetUp● TearDown● Test● Assertion

– Value– Message

● Test sets

Page 8: Drupal and testing (2010 - 2011 / 2)
Page 9: Drupal and testing (2010 - 2011 / 2)

Unit test libs

● PHPUnit (PHP)● http://www.phpunit.de/manual/3.4/en/writing-tests-for-phpunit.html

● JUnit (Java)● NUnit (C#)● Simpletest (PHP)

Page 10: Drupal and testing (2010 - 2011 / 2)

Functional test

● UI● Text● Widgets (button, form, ...)

● Behavior● Workflow● Browser

Page 11: Drupal and testing (2010 - 2011 / 2)
Page 12: Drupal and testing (2010 - 2011 / 2)

Functional test libs

● Selenium● Core● Plugins (Eclipse, Firefox)● RC● Grid

● Castle

Page 13: Drupal and testing (2010 - 2011 / 2)

Drupal + test

● Simpletest (unit + ~functional)● D6 → use Simpletest module● D7 → in core● Subclass DrupalWebTestCase

● In case of OpenAtrium: AtriumWebTestCase

Page 14: Drupal and testing (2010 - 2011 / 2)

Drupal + Simpletest

● Start test (WebUI or script)● Create new environment● Run tests● Clear environment

Page 15: Drupal and testing (2010 - 2011 / 2)

DEMO

Page 16: Drupal and testing (2010 - 2011 / 2)
Page 17: Drupal and testing (2010 - 2011 / 2)

Links

● http://en.wikipedia.org/wiki/Test-driven_development● http://www.phpunit.de/● http://xunitpatterns.com/● http://www.drupal.org/project/simpletest● http://qa.drupal.org/