Drupal: Speed Up Simpletest Tests Usign Live Database

April 2012 ยท 1 minute read

If you want to speed up Drupal Simpletest bootstrap a simple trick is to use the live database instead of the sandbox enviroment created by Simpletest. To do this simply override setUp and tearDown methods as reported below:

<?php
class SampleTest extends DrupalWebTestCase {
  function setUp() {
    $this->setup = TRUE;
  }

  function tearDown() {
  }
  
  //Your test here...

Please note now you are using the live database… so eventual fake contents created by unit tests must be removed manually.

comments powered by Disqus