我在PHP中有以下Selenium测试:
<?PHP
require_once('PHPUnit/Extensions/SeleniumTestCase.PHP');
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setbrowser("*chrome");
$this->setbrowserUrl("http://change-this-to-the-site-you-are-testing/");
}
public function testMyTestCase()
{
$this->open("/frontend_dev.PHP");
try {
$this->assertTrue($this->isTextPresent("Local Coupons"));
} catch (PHPUnit_Framework_AssertionFailedError $e) {
array_push($this->verificationErrors, $e->toString());
}
}
}
当我尝试运行它时(通过运行“ PHP filename.PHP”),出现错误:
PHP Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /usr/share/PHP/PHPUnit/Extensions/SeleniumTestCase.PHP on line 60
这是有道理的,因为该类未在任何地方定义,但是为什么不呢?我安装了PHPUnit.看起来有点奇怪的是,PHPUnit不会包含一个名为PHPUnit_Framework_TestCase的类.有任何想法吗?
解决方法:
对于命令行测试运行程序,您应该为PHPUnit使用read the docs.您也可以从命令行运行“ PHPunit –help”.我相信您会发现您需要运行类似
PHPunit path/to/filename.PHP
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。