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).

Downloads

Version Downloads Date Links
7.x-1.x-dev tar.gz (8.79 KB) | zip (11.18 KB) 2011-Feb-25 Notes

Project Information


Maintainers for Selenium to SimpleTest

  • boombatower - 2 commits
    last: 1 year ago, first: 1 year ago

Issues for Selenium to SimpleTest

To avoid duplicates, please search before submitting a new issue.
All issues
Bug reports
Oldest open issue: 4 Mar 10
nobody click here