Tomas Doran > Test-WWW-Selenium-Catalyst > Test::WWW::Selenium::Catalyst

Download:
Test-WWW-Selenium-Catalyst-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.07   Source  

NAME ^

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

DEVELOPERISH RELEASE ^

This is still a test release. It's working for me in production, but it depends on a Java application (SeleniumRC), which can be unreliable. On my Debian system, I had to put firefox-bin in my path, and add /usr/lib/firefox to LD_LIBRARY_PATH. Every distro and OS is different, so I'd like some feedback on how this works on your system. I would like to find a clean solution that lets this module "Just Work" for everyone, but I have a feeling that it's going to look more like if(gentoo){ ... } elsif (debian) { ... } and so on. I can live with that, but I need your help to get to that stage!

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

SYNOPSIS ^

    use Test::WWW::Selenium::Catalyst 'MyApp', 'command line to selenium';
    use Test::More tests => 2;

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

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

METHODS ^

start(\%args)

Starts the Selenium and Catalyst servers, and returns a pre-initialized, ready-to-use Test::WWW::Selenium object.

Arguments:

app_uri

URI at which the application can be reached. If this is specified then no application server will be started.

port

Default: 3000

Port on which to run the catalyst application server. The MYAPP_PORT environment variable is also respected.

selenium_class

Default: Test::WWW::Selenium

Classname of Selenium object to create. Use this if you want to subclass selenium to add custom logic.

selenium_host
selenium_port

Location of externally running selenium server if you do not wish this module to control one. See also for details.

All other options passed verbatim to the selenium constructor.

NOTE: By default a selenium server is started when you use this module, and it's killed when your test exits. If wish to manage a selenium server yourself, (for instance you wish to start up a server once and run a number of tests against it) pass -no_selenium_server to import:

 use Test::WWW::Selenium::Catalyst 'MyApp',
   -no_selenium_server => 1

Along a similar vein you can also pass command line arguments to the selenium server via -selenium_args:

 use Test::WWW::Selenium::Catalyst 'MyApp',
   -selenium_args => "-singleWindow -port 4445"

sel_pid

Returns the process ID of the Selenium Server.

app_pid

Returns the process ID of the Catalyst server.

ENVIRONMENT ^

Debugging messages are shown if CATALYST_DEBUG or MYAPP_DEBUG are set. MYAPP is the name of your application, uppercased. (This is the same syntax as Catalyst itself.)

CATALYST_SERVER can be set to test against an externally running server, in a similar manner to how Test::WWW::Mechanize::Catalyst behaves.

The port that the application sever runs on can be affected by MYAPP_PORT in addition to being specifiable in the arguments passed to start.

DIAGNOSTICS ^

Specify your app's name

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

    use Test::WWW::Selenium::Catalyst 'MyApp'

MyApp is the name of your Catalyst app.

SEE ALSO ^

AUTHOR ^

Ash Berlin <ash@cpan.org>

Jonathan Rockway, <jrockway at cpan.org>

BUGS ^

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

PATCHES ^

Send me unified diffs against the git HEAD at:

    git://github.com/jrockway/test-www-selenium-catalyst.git

You can view the repository online at

    http://github.com/jrockway/test-www-selenium-catalyst/tree/master

Thanks in advance for your contributions!

ACKNOWLEDGEMENTS ^

Thanks for mst for getting on my (jrockway's) case to actually write this thing :)

COPYRIGHT & LICENSE ^

Copyright 2009 Ash Berlin, all rights reserved.

Copyright 2006 Jonathan Rockway, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: