Do it Live
Component ID
2866540
Component name
Do it Live
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
69
Component created
Component changed
Component body
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
LiveWebTestCaseclass that can be extended for running Web test cases against the active database. - Includes a drush command file that adds a
drush test-runcommand (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.');
}
}
