php自动化测试框架---PHP-QAT
一提到web自动化框架/工具,很多同行会想起: watir等。其实PHP的世界一样很精彩,流行PHP测试框架phpunit、simpletest、PHP-QAT 。PHP-QAT 能做单元测试、web应用测试等。1 下载安装
http://downloads.php.net/johannes/php-5.3.0alpha1.tar.gz
安装php: ./configure;make
在当前目录有run-tests.php。
2 环境设置
export TEST_PHP_EXECUTABLE=/usr/local/bin/php
3样例
$ cd/usr/local/apache2/php-5.3.0alpha1
$ ./run-tests.phpxyz/001.phpt
=====================================================================
PHP : /usr/local/bin/php
PHP_SAPI : cli
PHP_VERSION : 5.3.0alpha1
ZEND_VERSION: 2.3.0
PHP_OS : Linux - Linux alitest146 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686
INI actual: /usr/local/apache2/php-5.3.0alpha1
More .INIs:
CWD : /usr/local/apache2/php-5.3.0alpha1
Extra dirs:
VALGRIND : Not used
=====================================================================
Running selected tests.
b user is/usr/local/apache2/php-5.3.0alpha1/xyz/001.phptArray/usr/local/apache2/php-5.3.0alpha1/xyz/001.phpt is fileTEST 1/1
=====================================================================
Number of tests : 1 1
Tests skipped : 0 (0.0%) --------
Tests warned : 0 (0.0%) (0.0%)
Tests failed : 0 (0.0%) (0.0%)
Expected fail : 0 (0.0%) (0.0%)
Tests passed : 1 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken : 0 seconds
=====================================================================
$ cat xyz/001.phpt
--TEST--
Simple POST Method test
--SKIPIF--
<?php if (php_sapi_name()=='cli') echo 'skip'; ?>
--POST--
a=Hello+World
--FILE--
<?php
echo $_POST['a']; ?>
--EXPECT--
Hello World
4更多详细信息参考 http://qa.php.net/write-test.php
5 改造后的实际应用:
北京雅虎\阿里妈妈 其实很真不知道这个php QAT,更没有使用过了,不过发现还是值得去看看。
页:
[1]