Luke Closs > WWW-Selenium-Utils > WWW::Selenium::Utils

Download:
WWW-Selenium-Utils-0.09.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.09   Source  

NAME ^

WWW::Selenium::Utils - helper functions for working with Selenium

SYNOPSIS ^

  use WWW::Selenium::Utils qw(generate_suite);

  # convert .wiki files to .html and create TestSuite.html
  generate_suite( test_dir => "/var/www/selenium/tests",
                  base_href => "/monkey",
                  verbose => 1,
                );

DESCRIPTION ^

This package contains utility functions for working with Selenium.

SUBROUTINES ^

generate_suite

generate_suite() will convert all .wiki files in selenium/tests to .html, and then create a TestSuite.html file that contains links to all the .html files.

The .wiki files are much easier to read and write. The format of .wiki files is like this:

  title
  | cmd | opt1 | opt2 |
  | cmd | opt1 |
  # comment

  # empty lines are ignored
  # comments are ignored too

  # you can include other wiki files too!  These files should not 
  # have a title.  I'll look for the file in the same directory
  # as the current .wiki file
  include "foo.incl"

  # if you don't want included files to also be converted to html,
  # then don't name them .wiki

Parameters:

test_dir

The path to the 'tests' directory inside selenium.

verbose

If true, informative messages will be printed.

base_href

Will prepend the given location to all locations for the open and assert/verifyLocation commands.

perdir

Will create a separate TestSuite.html for each directory under test_dir.

index

Will create a html index of all available TestSuite.html files found inside test_dir.

generate_suite() will parse a config file if present at either $ENV{SELUTILS_ROOT}/etc/selutils.conf or $Config{prefix}/etc/selutils.conf.

Supported options in selutils.conf and are the same as the generate_suite() arguments:

test_dir
perdir

INTEGRATION WITH SELENIUM RECORDER ^

Selenium Recorder is Firefox extension that records your actions as you browse. The result is a test file that can be played back in Selenium.

It's quite easy to make Selenium Recorder generate a syntax that is directly compatible with the wiki syntax suggested here.

In Selenium Recorder 0.6, you can update templates by opening the "Preferences" from the Extension panel of Firefox, and then clicking "Save". Adjust the input fields as follows:

Template for new test html file

 ${name}
 ${commands}

Template for command entries in the test html file

 | ${command.command} | ${command.target} | ${command.value} |

Template for comment entries in the test html file

 # ${comment.comment}

Further information about Selenium Recorder is available at:

  http://www.openqa.org/selenium-ide/

DIAGNOSTICS ^

If you set the verbose option to 1 when calling generate_suite, the function will print lines detailing what it is doing.

DEPENDENCIES ^

Uses CGI.

BUGS AND LIMITATIONS ^

There are no known bugs in this module. Please report problums to Luke Closs (cpan@5thplane.com). Patches are welcome.

AUTHOR ^

Luke Closs (cpan@5thplane.com)

LICENCE AND COPYRIGHT ^

Copyright (c) 2005 Luke Closs (cpan@5thplane.com). All rights reserved.

This module is free software; you can redstribute it and/or modify it under the same terms as Perl itself. See perlartistic.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: