This project is not covered by Drupal’s security advisory policy.

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:

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:

// $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

  • Created by boombatower on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases