Test::WWW::Selenium::CGIApp - Test your CGIApp application with Selenium


Test-WWW-Selenium-CGIApp documentation  | view source Contained in the Test-WWW-Selenium-CGIApp distribution.

Index


NAME

Top

Test::WWW::Selenium::CGIApp - Test your CGIApp application with Selenium

DEVELOPER RELEASE

Top

This is a test release. It depends on a Java application (SeleniumRC), which can be unreliable. The API is still subject to change in incompatible ways in future versions.

Please report any problems to RT, the CGIApp mailing list, or the #cgiapp IRC channel on irc.perl.org. Thanks!

SYNOPSIS

Top

    use Test::WWW::Selenium::CGIApp 'MyApp';
    use Test::More tests => 2;

    my $sel = Test::WWW::Selenium::CGIApp->start; 
    $sel->open_ok('/');
    $sel->is_text_present_ok('Welcome to MyApp');

USE CASES

Top

This module could be helpful if you want to test a CGI::Application based project with Selenium and you don't want to involve a traditional web server such as Apache. It could be useful when working offline or on a personal desktop.

If you would rather test the application through a web-server, using Test::WWW::Selenium would be a better choice.

TECHNICAL OVERVIEW

Top

This module starts the SeleniumRC server and your CGIApp app so that you can test it with SeleniumRC. Once you've called Test::WWW::Selenium::CGIApp->start, everything is just like Test::WWW::Selenium|Test::WWW:Selenium.

METHODS

Top

start()

    my $sel = Test::WWW::Selenium::CGIApp->start(
        browser => "*firefox /usr/lib/firefox/firefox-bin",  # defaults to '*firefox'
    );




Starts the Selenium and CGIApp servers, and returns a pre-initialized, ready-to-use Test::WWW::Selenium object. Extra args are passed to Test::WWW::Selenium->new();

[NOTE] The selenium server is actually started when you use this module, and it's killed when your test exits.

sel_pid()

Returns the process ID of the Selenium Server.

app_pid()

Returns the process ID of the CGIApp server.

ENVIRONMENT

Top

Debugging messages are shown if TWS_DEBUG is set;

LIMITATIONS / TODOs

Top

* This module is a fork of Test::WWW::Selenium::Catalyst, but shares a lot of code. It would be nice if they more directly shared part of the same code base.

* Having more default settings for launching various browsers on different OSes would be nice. (And something that could be shared with Catalyst!)

* This module currently only supports dispatching through CGI::Application::Dispatch. It could be useful to support other styles.

DIAGNOSTICS

Top

Specify your app's name

You need to pass your app's module name as the argument to the use statement:

    use Test::WWW::Selenium::CGIApp 'MyApp';

MyApp is the module name of your App.

SEE ALSO

Top

*

Selenium website: http://www.openqa.org/

*

Description of what you can do with the $sel object: Test::WWW::Selenium

*

If you don't need a real web browser: Test::WWW::Mechanize::CGIApp

AUTHOR

Top

Mark Stosberg, <mark at summersault.com>

BUGS

Top

Please report any bugs or feature requests to bug-test-www-selenium-cgiapp at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-WWW-Selenium-CGIApp. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

Top

Thanks for Test::WWW::Selenium::Catalyst, which provided most of the code for this.

COPYRIGHT & LICENSE

Top


Test-WWW-Selenium-CGIApp documentation  | view source Contained in the Test-WWW-Selenium-CGIApp distribution.