Page 1 of 1

No tests found in class ?

Posted: Thu Jan 07, 2010 3:15 pm
by simplyi
Hello! I am new to PHPUnit testing and have one question.

I use NetBeans. Configured PHPUnit and got it working. When I create a Test out of existing class "UsersDAO.php" using Nestbeans's special menu options for creating Tests then Netbeans generates Test class and methods and when I Run the Test on UsersDAO.php then everything works ok. Test methods execute and I have the report. When I write test code and play with $this->assertNotEquals() some tests fails some tests pass. Everything is working.

My problem is that I created a new Test class not using Netbeans options to Generate test methods. Placed this new class in same Tests folder where other Test classes are located but when I run this class the tests methods are not called! Why? I get a waring message that

"No tests found in class "InviteUsersTest".

:( May I ask you to advise me where is the problem. Here is my shortened Test class which I believe should execute because it does have one test method.

Code: Select all

<?php
ini_set("include_path", "../db".PATH_SEPARATOR."../../db".PATH_SEPARATOR.ini_get("include_path"));
require_once 'PHPUnit/Framework.php';
require_once 'C:\phpprojects\InviteUsersToValidate\db\UserDAO.php';
require_once 'C:\phpprojects\InviteUsersToValidate\db\UserVO.php';

class InviteUsersTest extends PHPUnit_Framework_TestCase
{
    public function getNotValidatedUsers()
    {
        $dao = new UserDAO();
        $dao->openConnection();
        $records = $dao->getNotValidatedUsers();
        $this->assertNotNull($records);

        $countRecords = count($records);
        $this->assertNotEquals(0, $countRecords);
        $dao->closeConnection();
    }
}

?>
Thank you!

Re: No tests found in class ?

Posted: Thu Feb 11, 2010 3:05 pm
by josh
Test method must start with "test"