How do I solve this error: "Class PHPUnit_Extensions_SeleniumTestCase could not be found" How do I solve this error: "Class PHPUnit_Extensions_SeleniumTestCase could not be found" selenium selenium

How do I solve this error: "Class PHPUnit_Extensions_SeleniumTestCase could not be found"


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

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

pear uninstall phpunit/PHPUnitpear uninstall phpunit/PHPUnit_Seleniumpear install phpunit/PHPUnit

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

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


Here is the deal:

If you have a "Class PHPUnit_Extensions_SeleniumTestCase could not be found in (testcase file name)" problem, you have to do the following two things:

1. Rename the file of test case to the name of the class it contains2. You should launch phpunit from the folder with your tests.

This should fix your problem.

Andrew


Have a look at one of the comments in the require_once entry in the php manual..

http://ie.php.net/manual/en/function.require-once.php#62838

"require_once (and include_once for that matters) is slow

Furthermore, if you plan on using unit tests and mock objects (i.e. including mock classes before the real ones are included in the class you want to test), it will not work as require() loads a file and not a class."