如何解决此错误:“找不到类PHPUnit_Extensions_SeleniumTestCase"; [英] How do I solve this error: "Class PHPUnit_Extensions_SeleniumTestCase could not be found"

查看:254
本文介绍了如何解决此错误:“找不到类PHPUnit_Extensions_SeleniumTestCase";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用phpunit运行SeleniumTestCase,但无法使其与phpunit.bat脚本一起运行.

I am trying to run a SeleniumTestCase with phpunit but I cannot get it to run with the phpunit.bat script.

我的目标是在CruiseControl& amp;中将phpunit与Selenium RC一起使用phpUnderControl.测试结果如下:

My goal is to use phpunit with Selenium RC in CruiseControl & phpUnderControl. This is what the test looks like:

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp()
    {
        $this->setBrowser('*firefox');
        $this->setBrowserUrl('http://www.example.com/');
    }

    public function testTitle()
    {
        $this->open('http://www.example.com/');
        $this->assertTitleEquals('Example Web Page');
    }
}

我在包含Selenium扩展名的include_path和PHPUnit中也安装了PEAR.我用pear安装程序安装了这些,所以我想这不是问题.

I also got PEAR in the include_path and PHPUnit installed with the Selenium extension. I installed these with the pear installer so I guess that's not the problem.

任何帮助将不胜感激.

Any help would be very much appreciated.

谢谢雷米

推荐答案

希望这是一个比此处给出的答案更明确的答案(这没有解决我的问题).如果遇到此错误,请检查您的PEAR文件夹,并查看"SeleniumTestCase.php"文件是否确实存在:

hopefully this is a more definitive answer then the ones given here (which did not solve me problem). If you are getting this error, check your PEAR folder and see if the "SeleniumTestCase.php" file is actually there:

/PEAR/PHPUnit/Extensions/SeleniumTestCase.php

如果不是,那么最简单的方法是使用PEAR卸载并重新安装PHPUnit ...

If it is NOT, the easiest thing to do is to uninstall and reinstall PHPUnit using PEAR ...

pear uninstall phpunit/PHPUnit

pear uninstall phpunit/PHPUnit_Selenium

pear install phpunit/PHPUnit

完成上述操作并仅执行单个安装后,PHPUnit_Selenium也已自动安装,我不确定这是否是典型的,因此有些操作可能必须这样做...

After doing the above and doing just the single install, PHPUnit_Selenium was also auto installed, I'm not sure if this is typical, so some might have to do...

pear install phpunit/PHPUnit_Selenium

另请参见 http://www.phpunit.de/manual/3.5/zh_cn/installation.html 以获得PEAR频道信息...

Also see http://www.phpunit.de/manual/3.5/en/installation.html for PEAR channel info if needed...

这篇关于如何解决此错误:“找不到类PHPUnit_Extensions_SeleniumTestCase";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆