Formats for the Selenium IDE

Published on March 11, 2007 and tagged with cakephp  firefox  selenium  testing

The Selenium IDE (a plug-in for Firefox) allows you to record tests. A guy called “wishcow” published now a format which makes it possible to export those tests for the Selenium helper. Based on his format I wrote a format for creating test cases for the Selenium test suite. You can find it (plus the helper and the test suite) in the downloads section,

The installation is simple (you can find a graphical installation guide on “wishcow”’s blog):

  • Open the Selenium IDE
  • Select “Options”/”Options…”
  • Switch to “Formats”
  • Choose “Add”
  • Define a name and copy&paste the format in the text area
  • Click on “Ok” to save it

Happy testing :)

8 comments baked

  • Mandy March 11, 2007 at 20:13

    Can you please explain how your format is different from wishcows format? I want to use Selenium and find the IDE super easy to use, but don’t know where to start on integrating it with cake? Can you shed some light on it form a beginner point of view?

  • cakebaker March 12, 2007 at 08:56

    @Mandy: Well, wishcows format creates something like

    <?php
    $selenium->open('http://www.example.com');
    ?>
    

    whereas my format creates the following code:

    <?php
    class MyTest extends SeleniumTestCase {
        var $title = '';
    
        function execute() {
            $this->open('http://www.example.com');
        }
    }
    ?>
    

    Also have a look at http://cakebaker.42dh.com/tags/selenium, where you find some Selenium related articles.

    HTH

  • Wiktor June 10, 2007 at 20:23

    Hmm, I see that the test case is different (for example, there are $this-> references), but I don’t have the “class MyTest extends SeleniumTestCase” part in my exported test case.

  • cakebaker June 11, 2007 at 18:57

    @Wiktor: Hm, I don’t understand what you mean…

  • Wiktor June 11, 2007 at 21:13

    I save the Selenium IDE test to disk, open it and have one line (just an example):
    $this->open(‘/’);
    and from your post I understood that ther should be also the class declaration.

  • Wiktor June 11, 2007 at 21:17

    OK, I got it. In fact I only copied the test code to clipboard (Ctrl+C). To have the class declaration the Selenium IDE needs to know some name for it. So, when I export the test to disk under the “asdfasdf” name, the test looks as follows:

    open(‘/’);

    ?>

    ;)

  • Wiktor June 11, 2007 at 21:20

    or rather:

    class Asdfasdf extends SeleniumTestCase {
    var $title = ”;

    function execute() {
    $this->open(‘/’);

  • cakebaker June 12, 2007 at 18:59

    @Wiktor: Good to hear you figured it out :)

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License