Yii Framework Forum: Cant get PHPUnit and selenium working correctly - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Cant get PHPUnit and selenium working correctly

#21 User is offline   TriAnMan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 10-November 11

Posted 07 September 2012 - 02:27 PM

View Postoutrage, on 29 June 2012 - 04:32 PM, said:

I still have to figure out what the problem is with this:

"Warning: include(): Failed opening 'MyTest: Firefox.php' for inclusion..."
"Warning: include(): Failed opening 'MyTest: Chrome.php' for inclusion..."

Fix for the PHPUnit issue https://github.com/s...unit/issues/631 causing this problem were merged into PHPUnit's master branch (see: https://github.com/s...hpunit/pull/636 ). So, waiting for next release of PHPUnit or using development version. (:

#22 User is offline   Lexne 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 10-October 12
  • Location:London

Posted 15 May 2013 - 04:23 AM

I had a simular problem and it seamed to be fixed when I added the line below at the top of my SeleniumTestCase.php

I am using Windows xampp and had that file located: C:\xampp\php\PEAR\PHPUnit\Extensions

Hope it helps someone else.

Now I only have one problem left and that is that when I get a failing test I get
Fatal error: Call to undefined method PHPUnit_Framework_ExpectationFailedExpectation::getCustomMessage() in C:\xampp\php\PEAR\PHPUnit\Extensions\SeleniumTestCase.php

But on successful test I get it to pass. Anyone got any idea how I can fix so that I can see what failed?

#23 Guest_Yii Tutor_*

  • Group: Guests

Posted 16 May 2013 - 08:27 AM

to learn yii visit this website www.yiitutorial.com

View PostTommo, on 22 February 2011 - 10:19 PM, said:

Hopefully someone will be able to help me with this because I've been pulling my hair out for hours on this one...

I am reading the Agile Web Application Development Book and I'm up to the part about testing. In this book they recommend installing Selenium and PHPUnit
I have successfully installed Selenium R C
I'm running WAMP server 2.0 on Windows Vista

I have tried to install PHPUnit 2 ways.

1. The first way was through PEAR. PEAR managed to download it and install it okay...but when I try to run phpunit I get the following error message.

'phpunit' is not recognized as an internal or external command, operable program or batch file.

As far as I can tell this means that the phpunit executable file does not exist in my PATH environment variable. Trouble is, I cant find ANY phpunit executable file. It just doesn't seem to exist...

2. So I tried another way of installing it. I downloaded directly from GITHUB and extracted the archive to my computer. This time, I had more luck, I can get phpunit running (ie: There is an executable) but when I run it on a test case I get these error messages...

The command I ran
c:\wamp\www\yii\agile\protected\tests>phpunit functional/SiteTest.php

The error message
PHP Warning:  require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to o
pen stream: No such file or directory in C:\wamp\www\yii\framework\test\CWebTest
Case.php on line 11

Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open s
tream: No such file or directory in C:\wamp\www\yii\framework\test\CWebTestCase.
php on line 11
PHP Fatal error:  require_once(): Failed opening required 'PHPUnit/Extensions/Se
leniumTestCase.php' (include_path='C:\wamp\bin\php\php5.3.0\PEAR;.;C:\wamp\bin\p
hp\php5.3.0\pear') in C:\wamp\www\yii\framework\test\CWebTestCase.php on line 11

Fatal error: require_once(): Failed opening required 'PHPUnit/Extensions/Seleniu
mTestCase.php' (include_path='C:\wamp\bin\php\php5.3.0\PEAR;.;C:\wamp\bin\php\ph
p5.3.0\pear') in C:\wamp\www\yii\framework\test\CWebTestCase.php on line 11

I have tried searching for that file (ie:SeleniumTestCase.php) on the net but can barely find any information on it. I can't find it on my HD so where do I get a copy of it?

Does anyone know how to fix this problem? I'm completely stumped and I would be so grateful if someone could help me out.

Thanks heaps


#24 User is offline   Tran Duc Loi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 19-June 13

Posted 20 June 2013 - 12:23 PM

View PostTommo, on 24 February 2011 - 03:16 PM, said:

Thanks for your help Seb,

I have got it working now...

For anyone else who is having the same problem...

Using the pear installer doesn't seem to work very well.

So I downloaded PHPUnit_Selenium and PHPUnit packages from pear.phpunit.de/

These are tgz files so you just unzip them to your include directory as specified in php.ini Make sure the phpunit_selenium file/folder structure is merged with the phpunit file/folder structure.

Then you should be good to go!

I've got the same problems and now can fixed with your advices. Thanks.

#25 User is offline   Neil Kenealy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 31-October 11

Posted 05 November 2013 - 03:50 AM

I did the installation using composer from my project root directory.

Here's the contents of my composer.json

"require-dev": {
"phpunit/phpunit": "3.7.*",
"phpunit/phpunit-selenium": ">=1.2",
"phpunit/php-invoker": "*"

Then I ran php composer.phar update from project root dir


Share this topic:

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users