0
我想測試我的php web應用程序加載每個頁面的速度有多快,所以我想通了硒測試。我建立這個測試登錄我的應用程序,並參觀用php selenium報告頁面加載時間
<?php
class Example extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser("firefox");
$this->setBrowserUrl("xxxx");
}
public function testMyTestCase()
{
$this->open("/user/login");
$this->type("id=username", "xxxx");
$this->type("name=password", "xxxx");
$this->click("name=submit");
$this->waitForPageToLoad("30000");
$this->open("xxxxxx");
$this->waitForPageToLoad("30000");
$this->open("xxxxx");
$this->waitForPageToLoad("30000");
$this->click("link=logout");
$this->waitForPageToLoad("30000");
}
}
?>
兩個頁面現在我想有某種報告的輸出每個頁面的加載時間這個測試訪問。我正在考慮使用PHP microtime,但這隻會輸出腳本渲染時間,但我想知道全部時間(腳本渲染,圖像/ css/js加載和是否有ajax調用)
是否有任何可能訪問請求對象以獲取請求開始和結束時間的方式?或者某種插件來獲取這些信息?
在此先感謝
這是一個解決辦法會有什麼工作,但我想有一個自動化的方式來測試頁面。它們可能會有所不同,需要每30分鐘進行一次測試 – acrobat