APP-REST-RestTestSuite
view release on metacpan or search on metacpan
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
my $suite = APP::REST::RestTestSuite->new();
$suite->execute_test_cases( $suite->get_test_cases() );
my ( $cases_in_config, $executed, $skipped, $passed, $failed ) =
$suite->get_result_summary();
#OR
use APP::REST::RestTestSuite;
# overrides the default config and log file paths
my $suite = APP::REST::RestTestSuite->new(
REST_CONFIG_FILE => <config file>,
LOG_FILE_PATH => <path>,
);
$suite->execute_test_cases( $suite->get_test_cases() );
my ( $cases_in_config, $executed, $skipped, $passed, $failed ) =
$suite->get_result_summary();
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
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
my ( $config, $total, $total_response_time, $skip, $pass, $fail ) = (0) x 6;
my ( $uri, $method, $req_content_type, $req_body, $status ) = (undef) x 5;
my ( $request, $response ) = (undef) x 2;
my ( $username, $password ) = (undef) x 2;
$username = $self->{username};
$password = $self->{password};
lib/APP/REST/RestTestSuite.pm view on Meta::CPAN
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
$pua->duplicates(0); # ignore duplicates
$pua->timeout(60); # in seconds
$pua->redirect(1); # follow redirects
$pua->default_header('Accept' => '*/*'); # to get cross platform support
my ( $config, $total, $total_response_time, $skip, $pass, $fail ) = (0) x 6;
my ( $uri, $method, $req_content_type, $req_body, $status ) = (undef) x 5;
my ( $request, $response ) = (undef) x 2;
my ( $username, $password ) = (undef) x 2;
$username = $self->{username};
$password = $self->{password};
my $fh = $self->get_log_file_handle();
script/rest-client view on Meta::CPAN
-V,--version Print the version of the tool.
-c,--configfile=<file> Input the config file with full path.
-l,--logdir=<dir> Input full path of the directory where you want to log the test results.
-t,--test-load=n Test the average response time by simulating 'n' number of requests on the web server.
Commands:
-r,--run-test-suite Test the configured web services defined in the config file.
-g,--get-sample-config Get a sample config file to configure your web services as test suite.
***Note:
By default tool uses the sample-config file. You need to get that and configure the suite.
Examples:
$client --get-sample-config
# Get sample config file for configuring web services in the current directory.
$client --run-test-suite --configfile=<rest_config_file>
# Execute the test suite against the supplied config file.
# Supply the full path of config file if it is not present in current directory.
$client --test-load=10 --configfile=<rest_config_file>
script/rest-client view on Meta::CPAN
} elsif ($config_file) {
print "Parsing Config File : $config_file\n\n";
$suite = new APP::REST::RestTestSuite( REST_CONFIG_FILE => $config_file, );
} elsif ($log_dir) {
print <<HELP;
Using log dir as : $log_dir
Using the default test suite. This is just for a demo purpose.
Use below options to specify the config file and log path.
$client --configfile=<rest_config_file> --logdir=<log-directory-path>
HELP
$suite = new APP::REST::RestTestSuite( LOG_FILE_PATH => $log_dir, );
} else {
unless ( $action->{getsampleconfig} ) {
print <<HELP;
Using the default test suite. This is just for a demo purpose.
Use below options to specify the config file and log path.
$client --configfile=<rest_config_file> --logdir=<log-directory-path>
Use below option to get a sample config. Edit the config file to configure your web services
$client --get-sample-config
HELP
}
script/rest-client view on Meta::CPAN
-V,--version Print the version of the tool.
-c,--configfile=<file> Input the config file with full path.
-l,--logdir=<dir> Input full path of the directory where you want to log the test results.
-t,--test-load=n Test the average response time by simulating 'n' number of requests on the web server.
Commands:
-r,--run-test-suite Test the configured web services defined in the config file.
-g,--get-sample-config Get a sample config file to configure your web services as test suite.
***Note:
By default tool uses the sample-config file. You need to get that and configure the suite.
Examples:
rest-client --get-sample-config
# Get sample config file for configuring web services in the current directory.
rest-client --run-test-suite --configfile=<rest_config_file>
# Execute the test suite against the supplied config file.
# Supply the full path of config file if it is not present in current directory.
rest-client --test-load=10 --configfile=<rest_config_file>
( run in 0.380 second using v1.01-cache-2.11-cpan-0a6323c29d9 )