APP-REST-RestTestSuite

 view release on metacpan or  search on metacpan

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN


    return (
        $self->{test_result_log}->{test_cases_in_config},
        $self->{test_result_log}->{test_cases_exececuted},
        $self->{test_result_log}->{test_cases_skipped},
        $self->{test_result_log}->{test_cases_passed},
        $self->{test_result_log}->{test_cases_failed},
    );
}

=head2 validate_test_cases


=cut

sub validate_test_cases {
    my ($self) = shift;

    my $err = undef;

    unless (@_) {
        $err = "There is no test cases defined to execute.\n";
    } elsif ( ( (@_) % 2 ) == 1 ) {
        $err =
            "Test cases are not properly configured in '"
          . $self->get_config_file()

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN


=head2 execute_test_cases


=cut

sub execute_test_cases {
    my ($self) = shift;

  #expects an hash with keys as test case number and value as hash ref with test
  #specification; validate that before trying to execute them.
    my $err = $self->validate_test_cases(@_);

    die "ERROR: $err\n" if ($err);

    my %test_cases = @_;

    my $ua = LWP::UserAgent->new;

    $ua->agent("RTAT/$VERSION");
    $ua->timeout(90);    # in seconds
    $ua->default_header('Accept' => '*/*'); # to get cross platform support

lib/APP/REST/RestTestSuite.pm  view on Meta::CPAN


=head2 execute_test_cases_in_parallel


=cut

sub execute_test_cases_in_parallel {
    my ($self) = shift;

#Code expects an hash with keys as test case number and value as hash ref with test
#specification; validate that before trying to execute them.
    my $err = $self->validate_test_cases(@_);

    die "ERROR: $err\n" if ($err);

    my %test_cases = @_;

    # use my customized user agent for parallel invokes
    my $pua = APP::REST::ParallelMyUA->new();

    $pua->agent("RTAT/$VERSION");
    $pua->in_order(1);      # handle requests in order of registration



( run in 0.555 second using v1.01-cache-2.11-cpan-a5abf4f5562 )