php phpunit selenium,phpunit+selenium环境筹建
phpunit+selenium環境搭建
這個環境搭建遇到了挺多麻煩,最終還是沒能自己解決,幸好有同事“青蛙”的幫忙解決了這個問題!在這里把本人親測步驟給大家列一下,希望給大家提供方便!
安裝pear:
Go-pear.phar下載地址:http://download.csdn.net/detail/e421083458/4602207
下載go-pear.phar文件到C:\wamp\bin\php\php5.3.13\PEAR中
然后執行以下命令:
cd C:\wamp\bin\php\php5.3.13
php -d phar.require_hash=0 PEAR/go-pear.phar
然后就是遇到回車就回車,輸入Y就Y。安裝之后它會提示你雙擊一下。
c:\wamp\bin\php\php5.3.13\PEAR_ENV.reg?以添加環境變量?照做就是。為了下面操作和以后使用方便需要將php添加到環境變量里面。
升級pear?:
直接安裝phpunit它會提示版本過低?這里就要升級pear了
Pear clear-cache
pear upgrade pear
成功升級后的截圖:
Pear upgrade-all
產品升級后的截圖
安裝phpunit
pear clear-cache
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install -a -f phpunit/PHPUnit
安裝成功截圖:
安裝phpunit擴展
pear channel-discover pear.symfony.com
pear install phpunit/DbUnit
pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit_Story
成功截圖:
安裝selenium擴展
pear install phpunit/PHPUnit_Selenium
成功截圖:
調試selenium
selenium-server-standalone-2.6.0.jar下載地址:http://download.csdn.net/detail/e421083458/4882037
打開selenium-server
java -jar C:\wamp\selenium-server-standalone-2.25.0.jar -interactive -log selenium.log
成功截圖:
安裝firefox的selenium?IDE插件
地址:http://seleniumhq.org/download/
點擊1.9.0進行selenium?IDE安裝。
具體錄制方法見:
http://blog.163.com/lgh_2002/blog/static/44017526201259113351146/
測試腳本:
baiduCase.php
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("http://www.baidu.com/");
}
public function testMyTestCase()
{
$this->open("/");
$this->type("id=kw", "你好");
$this->click("id=su");
$this->waitForPageToLoad("30000");
$this->assertEquals(0,0);
}
}
?>
開始測試:
phpunit?baiduCase.php
測試成功截圖:
參考文檔:
http://www.phpunit.de/manual/3.7/en/index.html
http://pear.phpunit.de/
http://seleniumhq.org/download/
總結
以上是生活随笔為你收集整理的php phpunit selenium,phpunit+selenium环境筹建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 长方体重力异常正演matlab,骆遥 (
- 下一篇: php执行dmidecode,Pytho