APNIC (Asia-Pacific Network Information Centre) > Test-WWW-Selenium-HTML-0.01 > Test::WWW::Selenium::HTML

Download:
Test-WWW-Selenium-HTML-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source   Latest Release: Test-WWW-Selenium-HTML-0.02

NAME ^

Test::WWW::Selenium::HTML - Run Selenium HTML tests directly

VERSION ^

0.01

SYNOPSIS ^

Provides for running Selenium HTML tests against a Test::WWW::Selenium object and producing TAP output:

    my $sel =
        Test::WWW::Selenium->new(
            host        => "localhost",
            port        => 4444,
            browser     => "*firefox",
            browser_url => "http://localhost:$port/"
        );
    my $selh = Test::WWW::Selenium::HTML->new($sel);
    $selh->run(path => "./path/to/selenium/file.html");

run will print TAP output as it progresses through the specified tests. run may be called multiple times, and other tests may occur before and after calls to run. For example, given a Selenium HTML file like so:

    ...
    <tr>
        <td>open</td>
        <td>test.html</td>
        <td></td>
    </tr>
    <tr>
        <td>click</td>
        <td>id=button</td>
        <td></td>
    </tr>
    ...

and a test file (test.t) like so:

    ...
    ok(1, "Some test");
    $selh->run(path => "./path/to/selenium/file.html");
    ok(1, "Some other test");
    $selh->run(path => "./path/to/selenium/file.html");
    ok(1, "Yet another test");
    ...

the output will be:

    ok 1 - Some test
    ok 2 - open(test.html, ) (./path/to/selenium/file.html:14; t/test.t:9)
    ok 3 - click(id=button, ) (./path/to/selenium/file.html:19; t/test.t:9)
    ok 4 - Some other test
    ok 5 - open(test.html, ) (./path/to/selenium/file.html:14; t/test.t:11)
    ok 6 - click(id=button, ) (./path/to/selenium/file.html:19; t/test.t:11)
    ok 7 - Yet another test

The Selenium HTML file/string provided to run must be valid XML. This will not normally be a problem, because the HTML produced by the Selenium IDE (via the 'Save Test Case' option) satisfies this requirement.

CONSTRUCTOR ^

new

Takes an instance of Test::WWW::Selenium as its only argument.

PUBLIC METHODS ^

run

Takes a hash of arguments:

data

A Selenium HTML document as a string.

path

A path to a Selenium HTML document.

Either data or path must be provided. The relevant Selenium HTML document in both cases must contain Selenium test specifications (the argument here will generally be the result of exporting in HTML format from the Selenium IDE). Runs the test specifications and returns a boolean indicating whether all of the tests were completed successfully.

vars

Returns the current internal variable state as a hashref. Modifications to this hashref will be reflected in the object, so it can be prepopulated (after calling new but before calling run) with variables needed by the tests. Any store test specifications in the tests proper will cause this hashref to be updated as per the specification.

diag_body_text_on_failure

Controls whether run_test will display the body text on test failure. If passed a true value, this feature is enabled, and vice versa; in both cases, the previous value of this switch is returned. If no argument is passed, returns the value of the switch. Defaults to true.

NOTES ^

Tested against Selenium IDE 1.0.12 and Selenium Servers 2.0rc2, 2.8.0, 2.12.0 and 2.19.0.

BUGS ^

Please report any bugs or feature requests to bug-test-www-selenium-html at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-WWW-Selenium-HTML.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Test::WWW::Selenium::HTML

You can also look for information at:

AUTHOR ^

 Tom Harrison
 APNIC Software, C<< <cpan at apnic.net> >>

LICENSE AND COPYRIGHT ^

Copyright 2012 APNIC Pty Ltd.

This library is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

The full text of the license can be found in the LICENSE file included with this module.

syntax highlighting: