No tests found in class ?

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
Forum Newbie
Posts: 10
Joined: Fri Dec 11, 2009 4:55 pm

No tests found in class ?

Post 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

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();
        $records = $dao->getNotValidatedUsers();

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

Thank you!
Last edited by Weirdan on Sat Jun 19, 2010 4:33 am, edited 1 time in total.
Reason: added syntax highlighting
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: No tests found in class ?

Post by josh »

Test method must start with "test"
Post Reply