Quantcast
Channel: Recent posts across whole site
Viewing all articles
Browse latest Browse all 49199

What is the state of unit testing with Drupal today?

$
0
0

Hi there,

I'm coming back to Drupal after a brief hiatus, and although I've looked around, I can't seem to find any up to date information about how best to unit test Drupal (I'm using D6 for now, but I haven't found anything for D7 either).

I'm asking about Unit testing, because my previous experiments with Integration Testing seemed unusably slow, and although there is this article here on lullabot, it's about 4 years old now, and it seems somewhat out of date.

A recent post here by Jacob Singh on the subject makes me start to think that it's just something that you can't do in any reasonable fashion with Drupal, but before I give up, I'd really like to ask here first.

There's a lot to like about Drupal as a platform, and I'm aware that Drupal's design can make unit testing hard, because you end up mocking up so much extra code to account for all the various hooks being fired everywhere that any test cases become extremely unwieldy.

Quoting Jacob Sing in the comments:

Everytime I've sat down to write unit tests in Drupal, my code ends up become so convoluted to avoid touch any piece of Drupal itself that I'm not testing anything. Couple that with the fact that because we are not using classes, I can't extend and mock up calls that would use Drupal.

I'm really wary about doing development on large projects without the safety net of tests - are there any resources people on the list here could point me to, to make unit testing with Drupal a reality?

Right now, the best bet seems to be using PHPUnit for unit tests, and Simpletest for Integration tests, which seems crazy.

Sorry if I sound a little negative, I'm aware there are large gaps in my knowledge of Drupal, and I'm welcome to be put straight if anything I've said above doesn't ring true.

Thanks


Viewing all articles
Browse latest Browse all 49199

Trending Articles