PHP A simple test tool simpletest
PHPUnit is a good unit testing tool, and this article introduces a more lightweight unit testing tool, open source,
SimpleTest,
1 Downloads:
http://sourceforge.net/projects/simpletest/,
Unfortunately the document and project main station want that xxx, everybody understand
2 use
After the download, as long as the test file contains the following two files, you can use the
Require_once (' simpletest/autorun.php ');
Require_once (' simpletest/web_tester.php ');
?>
3 Test An interface, for example.
Require_once (' simpletest/autorun.php ');
Require_once (' simpletest/web_tester.php ');
function Testcreatingnewfile () {
@unlink ('/temp/test.log ');
$log = new log ('/temp/test.log ');
$this->assertfalse (file_exists ('/temp/test.log '));
$log->message (' should write this to a file ');
$this->asserttrue (file_exists ('/temp/test.log '));
}
}
$test = &new testoflogging ();
$test->run (New Htmlreporter ());
?>
All of the test methods start with test by default, note that the $test->run (new Htmlreporter ()) is used last, and the output in HTML format is indicated.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.