+ All Categories
Home > Technology > Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Date post: 10-May-2015
Category:
Upload: phase2
View: 2,648 times
Download: 4 times
Share this document with a friend
Description:
These are the slides Erik Summerfield (e2thex) presented at DrupalCamp Austin 2013. During his talk, he explored the benefits of Test Driven Development (TDD) that he saw in writing the SPS module and how an Object Oriented (OO) approach helped make this process work. In addition, he discussed the challenges of doing TDD in Drupal and how to work through the using OO ideas.
Popular Tags:
25
OO and TDD in SPS is cool
Transcript
Page 1: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

OO and TDD in SPS is cool

Page 2: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

by Erik Summerfield Phase2 Technology [email protected] e2thex most other places

Page 3: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal
Page 4: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

What is SPS?

Page 5: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

The Site Preview System developed as part of the Content Staging Initative, fund by a Aquia's Large Scale Drupal Project

Page 6: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

What is TDD?

Page 7: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

.------------. .-------| edit Test | | '------------' v ^ .------------. .----------. | | write Test |---->| run Test |--Pass---' '------------' '----------' .------------. | .------| Edit Code | Fails | '------------' v v ^ .------------. .----------. | | write code |----->| run Test |--Fails-' '------------' '----------' | Pass v .---------------. | refactor code | '---------------'

Page 8: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

✩ Refactoring is so nice✩ Collaboration was smooth✩ Early Detection of Design Flaws

Page 9: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Doing TDD in Drupal

Page 10: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Unit vs Web

Page 11: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Tell Drupal about your tests

Page 12: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Base Class

Page 13: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Example at http://drupalcode.org/project/sps.git/blob/refs/heads/7.x-1.x:/tests/SPSBase.test

Page 14: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Writing Tests

Page 15: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Example at http://drupalcode.org/project/sps.git/blob/refs/heads/7.x-1.x:/tests/SPSDrupalUnit.test

Page 16: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Running Tests

Page 17: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

✩ php scripts/run-tests.sh --color GROUPNAME [output of command]✩ php scripts/run-tests.sh --verbose --color --class CLASSNAME[output of command]

Page 18: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Why OO for SPS?

Page 19: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

✩-SPS was a relatively comlicated system✩ Need to allow for extendablity✩ We could! (php 5.3)

Page 20: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Plugins

Page 21: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Plugins Class Interfaces

Page 22: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Fighting Drupal

Page 23: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Workaround hooks

Page 24: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Workaround for Forms

Page 25: Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

Questions?


Recommended