diff --git a/Build.PL b/Build.PL index d5a3313179..f424cacd47 100644 --- a/Build.PL +++ b/Build.PL @@ -109,6 +109,8 @@ Build.PL - NGCP-Panel build system including test fixtures ./Build test --webdriver=selenium-rc # from CPAN distro Alien-SeleniumRC ./Build test --webdriver=external --wd-server=127.0.0.1:5555 + ./Build test_tap --webdriver=external # outputs tap to tap/ folder + ./Build testcover --webdriver='phantomjs --webdriver=4444' =head2 Options @@ -129,7 +131,7 @@ external if the webdriver is launched externally =head2 C<--wd-server> Host:Port of the webdriver to which the tests should connect. -Default is set by Test::WebDriver to localhost +Default is set by Test::WebDriver to localhost:4444 =head2 C<--server> diff --git a/inc/Local/Module/Build.pm b/inc/Local/Module/Build.pm index e201477e6e..d3ea96c509 100644 --- a/inc/Local/Module/Build.pm +++ b/inc/Local/Module/Build.pm @@ -34,9 +34,8 @@ sub shutdown_servers { } } -around('ACTION_test', sub { - my $super = shift; - my $self = shift; +sub _test_preconditions { + my ($self) = @_; require Getopt::Long; my %opt = (server => 'http://localhost:5000'); @@ -73,6 +72,14 @@ around('ACTION_test', sub { }; $self->wait_socket($uri->host, $uri->port); $ENV{CATALYST_SERVER} = $opt{server}; +} + +around('ACTION_test', sub { + my $super = shift; + my $self = shift; + + $self->_test_preconditions; + try { $self->$super(@_); }; @@ -103,4 +110,12 @@ method ACTION_testcover { $self->do_system(qw(cover)); } +method ACTION_test_tap { + $self->depends_on('code'); + $self->_test_preconditions; + system( "mkdir -p tap" ); + $ENV{PERL_TEST_HARNESS_DUMP_TAP} = "tap/"; + $self->generic_test(type => 'default'); +} + END { shutdown_servers }