Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This project is not covered by Drupal’s security advisory policy.
Do it Live is a utility Drupal module. It contains helpers for writing and running SimpleTest cases intended for active site maintenance (as opposed to Core/Contrib generic CMS functionality).
Features
- Includes a
LiveWebTestCase
class that can be extended for running Web test cases against the active database. - Includes a drush command file that adds a
drush test-run
command (which is almost identical to the command included in drush versions 6.x and earlier). Useful for running your tests on a remote pre-production environment.
Drupal 8 support coming soon.
Getting started
Before you get started, you should be familiar with the process for writing SimpleTests cases in Drupal.
A sample test class might look like this:
/**
* @file
* You might put this in my_custom_module.test
*/
// Extend from the LiveWebTestCase class to run these tests against the active DB.
class MyCustomModuleTestCase extends LiveWebTestCase {
protected $old_cache_value;
public function setUp() {
// If you implement the setUp method, be sure to call the parent.
parent::setUp();
// Perhaps your tests depend on the cache being disabled.
$this->old_cache_value = variable_get('cache', FALSE);
variable_set('cache', FALSE);
}
public function tearDown() {
parent::tearDown();
// Restore the original cache value.
variable_set('cache', $this->old_cache_value);
}
/**
* Tests some functionality custom to your site.
*/
public function testSomeFunctionality() {
$this->drupalGet('path/to/your/page');
$this->assertText('Expected text', 'Did not find expected text on page.');
}
}
Supporting organizations:
Project information
- Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Developer Tools
- Created by iamEAP on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.