4
我期待將我的硒RC測試遷移到PHPUnit 3.3.2使用PHPUnit 3.4.12。Selenium RC引發sessionsid不應該是null,assertTextPresent,僅僅是phpunit 3.4的bug?
PHPUnit_Framework_Exception: Response from Selenium RC server for getLocation().
ERROR Server Exception: sessionId should not be null; has this session been started yet?.
例如:
public function testSending($browser)
{
...
$browser->click("send");
$browser->waitForPageToLoad("30000");
$browser->assertTextPresent("text");
}
下面是硒RC日誌(在Windows上運行):
當我使用assertTextPresent()
硒測試將失敗,出現以下的異常
15:40:19.676 INFO - Command request: isTextPresent[text, ] on session 153d03a123c42098711994f43c2db34
15:40:19.691 INFO - Got result: OK,false on session 153d023a123c42098711994f43cdb34
15:40:19.879 INFO - Command request: testComplete[, ] on session 153d023a123c4298711994f43c2db34
15:40:19.879 INFO - Killing Firefox...
15:40:20.269 INFO - Got result: OK on session 153d023a123c42098711994f43c2db34
15:40:20.472 INFO - Command request: getLocation[, ] on session null
15:40:20.472 ERROR - Exception running 'getLocation 'command on session null
java.lang.NullPointerException: sessionId should not be null; has this session been started yet?
正如你所看到的,測試應該已完成,如「殺死Firefox」位,但它繼續做其他事情並觸發導致異常的getLocation [,]命令。
我已經嘗試過與PHPUnit 3.3.2相同的測試,但沒有產生這個問題 - 測試會愉快地結束沒有getLocation()
。
任何想法?
完全相同的測試通過PHPUnit 3.3.2?看起來在Selenium會話停止之後,可能會有一些東西在你的推倒之中。任何自定義監聽器? – 2010-05-17 08:27:15
嗨Dave, 感謝您的評論。我有以下在我的推倒: 保護功能tearDown() { if($ this-> autoStop) { {{this-> stop(); } catch(RuntimeException $ e){} } } – user342775 2010-05-25 23:19:00