1 Replies Last post: Jan 26, 2013 12:52 AM by Andriy Bazanov  
Kasi Prasad Newbie 4 posts since
Oct 7, 2012
Currently Being Moderated

Jan 25, 2013 10:23 PM

PHPUnit and a single file containing multiple classes with test methods

Hi,

 

I have a single php file contaning multiple classes each with their own respective test methods. In my phpunit.xml config, I have defined the following section:

 

    <testsuites>
        <testsuite name="Specs">
            <directory suffix="Specs.php">specs</directory>
        </testsuite>
    </testsuites>

 

When running phpunit from the command line, it detects each of the classes and executes their test methods. I have configured PHPStorm to use the same phpunit.xml config file however when I right click on the root directory of the project and click Run specs it reports that no tests have been run.

 

Does PHPStorm use the directory element of phpunit.xml config to identify directories containing tests?

Andriy Bazanov Master 2,622 posts since
May 28, 2010
Currently Being Moderated
Jan 26, 2013 12:56 AM in response to: Kasi Prasad
Re: PHPUnit and a single file containing multiple classes with test methods

Hi Kasi,

 

Please show your Run/Debug Configuration for this (Run | Edit Configurations...) and what do you see in console when tests get executed by PhpStorm.

 

P.S.

Generally speaking it's not a great idea to have multiple test cases in single file -- having one case per file helps avoiding many problems...

More Like This

  • Retrieving data ...