NAME
WWW::Testafy - Testafy API for perl developers
SYNOPSIS
use WWW::Testafy;
my $te = new WWW::Testafy;
my $id = $te->run_test(
pbehave => qq{
For the url http://www.google.com
Given a test delay of 1 second
When the search query field is "Testafy"
Then the text "Did you mean: testify" is present
};
);
my $passed = $te->test_passed($id);
my $planned = $te->test_planned($id);
print "Passed $passed tests out of $planned\n";
print $te->test_results_as_string($id);
ATTRIBUTES
- base_api_uri - base URI of the api server
- response - HTTP::Response object received from the API server
- response_vars - hash of the JSON response
- ua - LWP::UserAgent object
METHODS
Basic
$self->make_api_request($api_command, $request_vars)
Args: api_command - command to send to API server $request_vars - hashref of values to be encoded into JSON
Returns: HTTP::Response object received
$self->message
Returns: value of 'message' key from JSON response
$self->error
Returns: arrayref of error messages from JSON response
$self->error_string
Returns: formatted error strings (joined with newlines)
Commands for tests
$self->run_test(%args), including pbehave and browser
If the asynchronous arg flag is set to 1, test is started in background. Otherwise, it waits for test to completed. The default is 0.
Args: %args - hash of arguments
Returns: trt_id of entry created for test
$self->test_status($trt_id)
Args: trt_id - test_run_test_id for test
Returns: current status of the individual test run $trt_id.
$self->test_planned($trt_id)
Args: trt_id - test_run_test_id for test
Returns: tests planned for the individual test run $trt_id.
$self->test_passed($trt_id)
Args: trt_id - test_run_test_id for test
Returns: tests passed in individual test run $trt_id.
$self->test_failed($trt_id)
Args: trt_id - test_run_test_id for test
Returns: tests failed in individual test run $trt_id.
$self->test_results($trt_id)
Args: trt_id - test_run_test_id for test
Returns: array of tests results. Each item in the array is an array ref of result_type & result.
$self->test_results_as_string($trt_id)
Returns: test results as a single string, effectively in TAP format.