Convert Selenium IDE PHP output to Drupal SimpleTest format.

To use:

  1. Download the Selenium IDE.
  2. Record a test or portion of a test.
  3. Export the test as PHP (File -> Export Test Case As -> PHP).
  4. Paste contents of exported test into conversion form (admin/config/development/simpletest_selenium).
  5. Copy all or part of converted test into desired SimpleTest.

For use with Drupal 6:

  1. Change core = 7.x to core = 6.x in the .info file.
  2. (Optional) Change the menu path from admin/config/development/simpletest_selenium to admin/configuration/simpletest_selenium in the .module file.

For example:

<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class
Example extends PHPUnit_Extensions_SeleniumTestCase
{
  function
setUp()
  {
   
$this->setBrowser("*chrome");
   
$this->setBrowserUrl("http://change-this-to-the-site-you-are-testing/");
  }
  function
testMyTestCase()
  {
   
$this->open("/");
   
$this->click("link=Privacy");
   
$this->waitForPageToLoad("30000");
   
$this->assertTrue($this->isTextPresent("Transparency and Choice"));
   
$this->assertEquals("Google Privacy Center", $this->getTitle());
   
$this->click("link=privacy principles");
   
$this->waitForPageToLoad("30000");
   
$this->type("q", "search");
   
$this->click("submit");
   
$this->waitForPageToLoad("30000");
   
$this->click("link=2");
   
$this->waitForPageToLoad("30000");
  }
}
?>

Turns into:

<?php
// $Id$
/**
* @file
*/
class Example extends DrupalWebTestCase {
  public static function
getInfo() {
    return array(
     
'name' => 'Example',
     
'description' => '...',
     
'group' => 'Example',
    );
  }
  protected function
testExample() {
   
$this->drupalGet('');
   
$this->clickLink(t('Privacy'));
   
$this->assertText(t('Transparency and Choice'));
   
$this->assertTitle(t('Google Privacy Center'));
   
$this->clickLink(t('privacy principles'));
   
$edit = array (
     
'q' => 'search',
    );
   
$this->drupalPost(NULL, $edit, t('submit'));
   
$this->clickLink(t('2'));
  }
}
?>

Sponsored by Clarity Digital Group (owners of NowPublic.com and Examiner.com).

Project Information

  • Maintenance status: Unknown
  • Development status: Under active development
  • Reported installs: 5 sites currently report using this module. View usage statistics.
  • Downloads: 1,130
  • Automated tests: Enabled
  • Last modified: March 3, 2010

Downloads