Ratings | | Unique User Downloads | | Download Rankings |
Not enough user ratings | | Total: 127 | | All time: 9,408 This week: 555 |
|
Description | | Author |
This class can test the output of application site scripts.
It can read the parameters of tests from files that define the name of each text, the URL of the application to test and request parameters to send to the tested application scripts, and a regular expression of the expected output.
The class can send a HTTP request to the server of the application to test with the specified parameters.
Then it checks of the returned response matches the specified test regular expression.
The class logs the success or failure of each test to a given log file. | |
|
Example
<?php
include_once('testbed.class.php');
# Configuration options
$temp_folder = 'temp';
$test_log = 'tests.log';
$test_log = implode('/', array($temp_folder, $test_log));
$date_format = "F jS Y g:i a";
$tests = array(
'tests/simple_example.tpl'
);
$testbed = new testing($test_log, $temp_folder, $date_format);
foreach ($tests as $test_location)
$testbed->test($test_location);
$testbed->end();
print nl2br(file_get_contents($test_log))."\n";
?>
|
Details
PHP Template Based Ajax Callback Testing Framework
------------- This Name is Too Long --------------
What is it for?
This library is designed to automate testing of backend callback functions of Ajax based web services
How does it work?
This library uses cURL to fetch from your app's backend and uses regex to interpret the results
A few examples of regex
Empty only: ^$
Any output: ^[\d\D]*$
Numbers : [\d]+
Visit http://www.phpliveregex.com/ to experiment until you find the regex string that works for you
The templates
tests has a simple example provided for reference.
Url parameter values must be provided one per line, and already url-encoded
Requirements
PHP5 is needed, as I use templates
cURL is needed
The webserver needs write access to the chosen temp directory, and to wherever you save your logs
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.