}
}
-sub test_directory {
- my ($self, $dir) = @_;
+sub start_everything {
+ my ($self) = @_;
if(!exists $self->{app_server_proc}) {
$self->start_app_server;
}
if($self->{selenium_rc}{start} && !$self->{selenium_rc}{selenium_server_proc}) {
$self->start_selenium_server;
}
- my @tests = File::Find::Rule->file()->name('*.html')->in($dir);
+}
+
+sub test_recursive {
+ my ($self, @proto) = @_;
+ my (@files, @dirs);
+ if (@proto) {
+ @files = grep /\.html$/, @proto;
+ @dirs = grep !/\.htmL$/, @proto;
+ } else {
+ $0 =~ /^(t\/.*).t$/ or die "Can't guess directory from $0";
+ @dirs = ($1);
+ }
+ $self->start_everything;
+ $self->test_file($_) for @files;
+ $self->test_directory($_) for
+ sort map File::Find::Rule->directory->in($_), @dirs;
+}
+
+sub test_directory {
+ my ($self, $dir) = @_;
+ $self->start_everything;
+ my @tests =
+ sort File::Find::Rule->file->name('*.html')->maxdepth(1)->in($dir);
+
for my $test (@tests) {
- $self->run_tests_for($test);
+ $self->test_file($test);
}
}
-sub run_tests_for {
+sub test_file {
my ($self, $html_file) = @_;
my $rows = $self->get_rows_for($html_file);
$self->{src}->run_test_table($rows);