views:

200

answers:

3

Has anyone applied XP principles in Drupal development?

E.g. I wonder about such things as unit testing and whether it may be used in Drupal development, or about continous integration. I am not sure about unit testing, because Drupal environment is a very specific thing and not enough object oriented to have mock objects. As I see it, peer-reviews can be realized in Drupal development, but more at the level where you discuss with another person which of the combinations of code and modules can be used to solve some task - this is where you usually make decisions in Drupal.

Also, there could be some development practices that help teams build Drupal site collaboratively with better effectiveness and I wonder if there are any.

If anyone has developed big Drupal sites in team, I appreciate your feedback on this progress, e.g. what you did to make development and management better.

+1  A: 

Have you looked at the Simpletest module? It's separate in D5 and D6, but in D7 it comes baked in. This is how I usually do my unit testing.

It's true that you can't do mock objects. instead, each test actually creates a brand new installation of drupal in a new database, runs whatever test you've specified, and then cleans up after itself. So, mocking the database is less of a problem.

That said, in Drupal 7 we've also got DBTNG, which is object oriented.

John Fiala
A: 

Pair programming is certainly possible. Continuous integration? If you set up some automated builds / tests that will run on every check-in, you can go a long way towards that. Iterations, the planning game, and things of that nature can easily be incorporated. Test Driven Development, even if not from a unit-testing standpoint - write a quick UI test (using Selenium for instance) and you can do red-green-refactor.

What I'm wondering is, what about Drupal makes you think it's in any way unique? :)

Chris Simmons
From your suggestion I conclude that I can devide Drupal testing in several areas: (1) Testing of Drupal is not broken generally (with Selenium) (2) Testing if some more specific modules work well. (3) Testing of 1 specific module in development
PHP thinker
+1  A: 

There are no barriers to it but a few pitfalls.

We use CI, unit tests, and peer reviews with a team of around 20 Drupal developers. Using subversion when a developer commits a job is triggered to build and test using Hudson. There is an AIM that you can use for this should you want to.

The pitfalls. One is configuration, we change this via update statements in a module created specifically for this. However this is not as reliable as we would like, and some configuration changes are very hard to express in code.

The other is that Simpletest is a little strange with it's setup so you have to create data from scratch. While this is good from a Unit testing pont of view. It makes automated testing of your final set up difficult.

However it has worked well for us and we are looking at using something like selenium for whole site testing.

We use scrum as a management framework, which seems to work quite well. It is also important with a larger project to have modules for distinct areas of functionality. Use contrib modules as much as you can.

Jeremy French
So you have somehow conntect SimpleTest tests to be run by Hudson - is that how it works? Is Hudson totally cloud-based or can be run on one's own server?Are there most preferrable areas to be tested with SimpleTest? Or it's just you accompany any custom modules you write with tests and that's it?
PHP thinker
Husson kicks off a shell script which runs simpletest and we convert simpletest results into junit xml format so hudson can interpret the results. You can run hudson on your own server, we were just lacking in integration machines so the cloud made sense. Mostly we just test our own modules, D6 module support for simpletest is a little sketchy.
Jeremy French