In svn trunk, I already checked in the testing framework (based on phpunit). There is no documentation though (only API comments). You may use trunk to create a new webapp and see how the skeleton test scripts are generated.
fixtures stores table data initializing tables to be tested. You need to install phpunit first. bootstrap.php is a script that will be invoked by phpunit when you start a test. Unfortunately, the test framework requires yii 1.1 since it needs some special database support that is only available in 1.1.
I'm going to add some examples of using this framework and also add support to yiic so that it can generate test code.
"Fatal error: Class 'WebTestCase' not found in C:app_pathprotectedtestsfunctionalSiteTest.php on line 2
PHP Fatal error: Class 'WebTestCase' not found in C:app_pathprotectedtestsfunctionalSiteTest.php on line 2"
<?php
// change the following paths if necessary
$yiit=dirname(__FILE__).'/../../YII_SVN/framework/yiit.php';
$config=dirname(__FILE__).'/../config/test.php';
require_once($yiit);
require_once(dirname(__FILE__).'/WebTestCase.php');
Yii::createWebApplication($config);
It looks like sometimes I got bootstrap initialized and sometimes not.
I get the error class not found message much more times.
I think I am not getting it to work because I dont know exactly how to configure phpunit properly in these files you had provided us.
I think I am not getting it to work because I dont know exactly how to configure phpunit properly in these files you had provided us.
DISCLAIMER: I’m writing a test framework for a CMS right now with PHPUnit, so I don’t know if this information is completely relevant (I haven’t used any for Yii). I was scratching my head for a while over ‘class not found’ sorts of things, and discovered that any files in my setup that I tested needed to have files included relative to where PHPUnit was being run from, not from where the file was.
Not sure if this is relevant to this situation, I don’t have time to learn the setup of the package, but there could be something similar going on in this situation .
Ok. PHPUnit takes a long running and shows me letter E more times than the number of tests
'E' means there was an error running the test, usually because there was a PHP error or a problem requiring a file (outside of Yii, at least). Not sure how you're having more errors than tests, unless a path is wrong and the test runners themselves are failing…
EEEEEE
Time: 06:00
There were 6 errors:
1) testIndex(SiteTest)
RuntimeException: Could not connect to the Selenium RC server.
C:DesenvolvimentoworkspacesphpYII_SVNframeworktestCWebTestCase.php:61
2) testContact(SiteTest)
RuntimeException: Could not connect to the Selenium RC server.
C:DesenvolvimentoworkspacesphpYII_SVNframeworktestCWebTestCase.php:61
3) testLoginLogout(SiteTest)
RuntimeException: Could not connect to the Selenium RC server.
C:DesenvolvimentoworkspacesphpYII_SVNframeworktestCWebTestCase.php:61
4) testIndex(SiteTest)
RuntimeException: Could not connect to the Selenium RC server.
C:DesenvolvimentoworkspacesphpYII_SVNframeworktestCWebTestCase.php:61
5) testContact(SiteTest)
RuntimeException: Could not connect to the Selenium RC server.
C:DesenvolvimentoworkspacesphpYII_SVNframeworktestCWebTestCase.php:61
6) testLoginLogout(SiteTest)
RuntimeException: Could not connect to the Selenium RC server.
C:DesenvolvimentoworkspacesphpYII_SVNframeworktestCWebTestCase.php:61
FAILURES!
Tests: 6, Assertions: 0, Errors: 6.
Qiang::I am getting started with PHPUnit and reading its guide. I will solve this issue with Selenium and came back with an answer