【发布时间】:2014-10-24 16:22:15
【问题描述】:
我在使用 Yii、PHPUnit 和 Selenium 启动自动化测试时遇到了一些问题 我已经设置了 Selenium 和 PHPUnit 并且当我运行 phpunit 时。我收到此错误:
Warning: include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such
file or directory in path_to/framework/YiiBase.php on line 427
Warning: include(): Failed opening 'PHPUnit_Extensions_Story_TestCase.php' for inclusion
(include_path='.:') in path_to/framework/YiiBase.php on line 427
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: The path to the driver executable
must be set by the phantomjs.binary.path capability/system property/PATH variable; for more
information, see https://github.com/ariya/phantomjs/wiki. The latest version can be downloaded
from http://phantomjs.org/download.html
我在后台运行 Selenium RC。我在测试文件夹中也有 PHPunit 文件夹,带有 Story 和 selenium 扩展。
我的代码看起来像这样
define('TEST_BASE_URL','http://some_local_url/');
class WebTestCase extends PHPUnit_Extensions_Selenium2TestCase
{
/**
* Sets up before each test method runs.
* This mainly sets the base URL for the test application.
*/
protected function setUp()
{
parent::setUp();
$this->setHost('localhost');
$this->setPort(4444);
$this->setBrowserUrl(TEST_BASE_URL);
}
}
class SiteTest extends WebTestCase
{
public function testIndex()
{
$this->open('');
$this->assertTextPresent('Welcome');
}
}
【问题讨论】:
-
能否包含您的
index-test.php或some_local_url的输入脚本? -
我需要 index-test.php 吗?可能是问题?!里面应该放什么?
标签: php unit-testing selenium yii phpunit