Tutorial :Selenium IDE and Drupal



Question:

Can I use Selenium IDE on a Drupal system?

I found http://drupal.org/project/selenium but that involves downloading Core and not using my current machine.

Does anybody know of a way to use the IDE with Drupal, or if not what do you suggest I do?


Solution:1

You can, in the same way that you can use selenium on just about any web page.

From what I can see (though I haven’t' used it) the selenium module seems to be more about using Drupal to store and run selenium tests, which is useful, but will not explicitly test your Drupal site. (edit: this module dosn't look like it is currently maintained)

Drupal comes with it's own testing framework which uses simpletest. This can do a lot of the testing that you will need. It can handle form submissions and check for text in a page. There are two cases that I personally have found that it is not very useful for:

  • Data integrity, where you would like to check that the content of a particular page is correct where you know what to expect on your system
  • Two is checking the site layout, where you wish to check your live site that certain elements appear as they should do.

    Selenium can be used for both of these, in the simplest case you can record tests against your site and play them back to check it. You can check for an elements existence and style. You can check that elements have the text you would expect. Even a few of these can be useful as a tool for checking the configuration of your site.

It is also possible to integrate selenium with simplest so that while running your simpletests through Drupal it will run selenium tests, however this can get very complicated and confusing.


Solution:2

There's a nice new module that takes Selenium exports (in PHP) and converts them to Drupal SimpleTest suites. http://drupal.org/project/simpletest_selenium

This is nice because you can then do continuous integration testing by using Drush to script the running of your tests.


Solution:3

The question is what do you want to achieve?

  • testing a Drupal site?
  • saving / playing back configuration settings (automation through the browser)?

The Firefox & Selenium IDE (FF extension) combination works great with Drupal for functional testing.

It also works great if you want to capture some Drupal configuration settings (that you'd like to play back e.g. in another environment) but there are better ways - Patterns and Strongarm modules - to achieve that.

A couple of tips & tricks:

  • while capturing clicks be careful with timings (between clicks), sometimes you need to add "pause" lines to your test case,

  • for HTML form checkboxes Selenium often records the "click" action instead of the much safer "check" or "uncheck" action (this is important if you run your test case several times against the same page / form),

  • if your page reloads when you click a certain link, use "clickAndWait" instead of the simple "click" action,

  • use "verifyTextPresent" often, especially if you're running your tests "blindly", using Selenium RC.


Solution:4

I use selenium IDE all the time. It's an awesome tool for productivity and communication.

But Drupal's Simpletest framework has a built in browser for user testing. So you probably won't that module.

See: http://www.lastcraft.com/web_tester_documentation.php
http://drupal.org/node/265762
http://www.lullabot.com/articles/drupal-module-developer-guide-simpletest


Solution:5

You can test Drupal 7 with SeLite, which extends Selenium IDE. It allows your tests to access (read and write to) a test DB (isolated from the DB of the tested application).

It's especially good for Drupal 7, which can have its data in (separate) SQLite DB. So if your test environment can use SQLite, your test data lifecycle will be very easy. However, you can benefit from SeLite even if your test Drupal instance uses other type of DB.

See https://code.google.com/p/selite/wiki/ProjectHome and https://code.google.com/p/selite/wiki/DrupalTutorial.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »