Problem with Netbeans 6.9.1 and Selenium

Hi Yii Users,

I am new to Yii and am using the latest version of the framework (v1.1.6.r2877) and am following the book "Agile Web Application Development with Yii Framework".

I am using Netbeans IDE 6.9.1 along with Selenium Module for PHP on Fedora 14.

I have PHP 5.3.5 and PHPunit 3.5.10.

The selenium module for PHP has the following files:

.netbeans/6.9/modules/org-netbeans-modules-selenium-php.jar

.netbeans/6.9/modules/org-netbeans-modules-selenium-server.jar

.netbeans/6.9/modules/ext/selenium/selenium-server-1.0.1.jar

I have successfully setup Netbeans as described here:

http://www.yiiframework.com/wiki/83/netbeans-ide-and-yii-projects/

Step debugging (with xdebug) works fine.

However, I am having problems running tests.

I don’t have Firefox 3 installed and have Firefox 4 b 11 instead. I edited the phpunit.xml by having the following as the only entry for browser:




	<selenium>

	  <browser name="Firefox on Linux"

		  browser="*firefox /usr/bin/firefox"

		  host="localhost"

		  port="4444"

		  timeout="30000"/>

	</selenium>



However, that failed to work. It says cannot connect to selenium server.

Any ideas?

So, I installed Opera and used the following config instead:




	<selenium>

	  <browser name="Opera on Linux"

		  browser="*opera"

		  host="localhost"

		  port="4444"

		  timeout="30000"/>

	</selenium>

When I run the test, Opera launches the page:

localhost/selenium-server/core/RemoteRunner.html?sessionId=2cc51910fa7346a99fb63585a07ffc37&multiWindow=true&baseUrl=http%3A%2F%2Flocalhost%2Ftestdrive%2Findex-test.php%2F&debugMode=false

When I manually visit the URL with port info (i.e. localhost:4444 as specified in phpunit.xml), it seems to work. However, phpunit somehow insists on launching the same without port information.

Can anyone suggest how I can get it to work?

I had the same problem. Seems to me that the embedded selenium server doesn’t work properly.

The solution is: start selenium server manually before you start NetBeans IDE and it will work.

i have a problem too,

i dont know if i’m too stupid or too tired to fix it.

i got netbeans 6.9.1 running on debian 6.0

i set it up for testing like described in the wiki article. but every time i try to run a test no browser opens but instead

i get




PHP Fatal error:  Uncaught exception 'CException' with message 'CHttpRequest is unable to determine the request URI.' in /usr/share/php/yii/web/CHttpRequest.php:410

Stack trace:

#0 /usr/share/php/yii/web/CHttpRequest.php(354): CHttpRequest->getRequestUri()

#1 /usr/share/php/yii/web/CUrlManager.php(315): CHttpRequest->getPathInfo()

#2 /var/www/protected/modules/user/components/EHttpRequest.php(9): CUrlManager->parseUrl(Object(EHttpRequest))

#3 /usr/share/php/yii/web/CHttpRequest.php(77): EHttpRequest->normalizeRequest()

#4 /usr/share/php/yii/base/CModule.php(372): CHttpRequest->init()

#5 /usr/share/php/yii/base/CApplication.php(489): CModule->getComponent('request')

#6 /usr/share/php/yii/web/CWebApplication.php(593): CApplication->getRequest()

#7 /usr/share/php/yii/base/CApplication.php(141): CWebApplication->init()

#8 /usr/share/php/yii/YiiBase.php(118): CApplication->__construct('/var/www/protec...')

#9 /usr/share/php/yii/YiiBase.php(91): YiiBase::createApplication('CWebApplication', '/var/www/protec...')

#10 /var/www/prot in /usr/share/php/yii/web/CHttpRequest.php on line 410



selenium is running and listening on localhost.




<phpunit bootstrap="bootstrap.php"

		colors="false"

		convertErrorsToExceptions="true"

		convertNoticesToExceptions="true"

		convertWarningsToExceptions="true"

		stopOnFailure="false">


    <selenium>

      <browser name="Firefox on Linux"

               browser="*firefox"

               host="localhost"

               port="4444"

               timeout="30000"/>

    </selenium>


</phpunit>


<!-------- bootstrap.php--------- ->


<?php


// change the following paths if necessary

$yiit='/usr/share/php/yii/yiit.php';

$config='/var/www/protected/config/test.php';


require_once($yiit);

require_once(dirname(__FILE__).'/WebTestCase.php');


Yii::createWebApplication($config);




<!----------- webtestcase ----------->

<?php


define('TEST_BASE_URL','http://localhost/index-test.php/');


class WebTestCase extends CWebTestCase

{

	protected function setUp()

	{

		parent::setUp();

		$this->setBrowserUrl(TEST_BASE_URL);

	}

}



i have no idea how to fix this

FIXED: It was too late yesterday. My own EHttpRequest wasnt very good for the testing environment. Not Using it solved everything. was gonna dump it anyway

I got this to work by downloading the latest selenium server and replacing the current one. Details here: www.khattam.info/solved-selenium-server-not-working-in-netbeans-6-9-1-2011-03-01.html. Hope this helps others facing similar problem.