PHPUnit Eclipse配置:未找到任何测试

PHPUnit Eclipse配置:未找到任何测试,php,eclipse,phpunit,xdebug,Php,Eclipse,Phpunit,Xdebug,在尝试使用PHPUnit将Eclipse设置为单元测试库时,我陷入了运行简单测试用例的困境。作为参考,我按照教程使用PHPUnit/Xdebug/Makegood设置Eclipse,唯一与给出的指导原则不同的是为PHPUnit/Makegood设置以下配置文件: config.xml: <phpunit backupGlobals="true" backupStaticAttributes="false" cacheTokens="false"

在尝试使用PHPUnit将Eclipse设置为单元测试库时,我陷入了运行简单测试用例的困境。作为参考,我按照教程使用PHPUnit/Xdebug/Makegood设置Eclipse,唯一与给出的指导原则不同的是为PHPUnit/Makegood设置以下配置文件:

config.xml:
    <phpunit backupGlobals="true"
         backupStaticAttributes="false"
         cacheTokens="false"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
         strict="false"
         verbose="false">
    <testsuites>
        <testsuite name="My Test Suite">
            <directory suffix=".php">/path/to/application/tests/</directory>
        </testsuite>
     </testsuites>
</phpunit>
config.xml:
/路径/到/应用程序/测试/
现在,问题的根源在于,我似乎无法使用Makegood从Eclipse运行PHPUnit测试。我编写的唯一测试(位于“/path/to/application/tests/”文件夹中,名为“test.php”)如下所示(直接取自):


为了运行测试,我右键单击“tests”文件夹并点击Eclipse中的“runall tests”,它将打印到控制台:

塞巴斯蒂安·伯格曼的PHPUnit 3.7.15

从中读取的配置 /path/to/application/config.xml

时间:0秒,内存:5.00Mb

没有执行任何测试

现在,当我尝试使用“path/to/application/tests/”目录中的命令“phpunit test.php”从命令行运行这些测试时,我得到以下控制台输出:

塞巴斯蒂安·伯格曼的PHPUnit 3.7.15

时间:0秒,内存:3.25Mb

OK(1个测试,5个断言)


很明显,我没有正确地告诉Makegood在哪里找到测试文件/如何运行测试,但我似乎无法确定如何解决这个问题。毫无疑问,对于如何在Eclipse中将所有PHPUnit组件装配在一起,我有一个糟糕的心智模型,因此,如果能够帮助我理解该体系结构,我将不胜感激。提前谢谢

“运行所有测试”的工作方式与您尝试使用它的方式不同“运行所有测试”运行您选择作为“测试文件夹”之一的所有测试(见下文)

我实际上把我的测试文件夹改成了这个

它只运行RuleData文件夹中的测试。你可以点击任何你喜欢的地方,并且“运行所有测试”将以这种方式运行。如果只想运行文件夹中的测试,只需选择“运行测试”

这里还有我的phpunitxml配置,它位于tests目录中

<?xml version="1.0" encoding="UTF-8"?>
<phpunit
         backupStaticAttributes="false"
         backupGlobals="false"
         bootstrap="./../application/third_party/CIUnit/bootstrap_phpunit.php"
         cacheTokens="false"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"

         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"

         strict="false"
         verbose="true"

         >
    <php>
        <ini name="memory_limit" value="2047M" />
    </php>

    <testsuites>
        <testsuite name="AllTests">
            <directory>.</directory>
        </testsuite>
    </testsuites>

    <filter>
      <blacklist>
        <directory suffix=".php">./../../</directory>
        <file></file>
        <exclude>
          <file></file>
        </exclude>
      </blacklist>
      <whitelist processUncoveredFilesFromWhitelist="true">
          <directory suffix=".php">./../application/models</directory>
          <directory suffix=".php">./../application/controllers</directory>
          <directory suffix=".php">./../application/libraries</directory>
          <directory suffix=".php">./../application/helpers</directory>
        <file></file>
        <exclude>
          <directory suffix="index.php">./../application</directory>
          <file></file>
        </exclude>
      </whitelist>
    </filter>
</phpunit>

.
./../../
./../application/models
./../应用程序/控制器
./../application/libraries
./../application/helpers
./../application
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
         backupStaticAttributes="false"
         backupGlobals="false"
         bootstrap="./../application/third_party/CIUnit/bootstrap_phpunit.php"
         cacheTokens="false"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"

         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"

         strict="false"
         verbose="true"

         >
    <php>
        <ini name="memory_limit" value="2047M" />
    </php>

    <testsuites>
        <testsuite name="AllTests">
            <directory>.</directory>
        </testsuite>
    </testsuites>

    <filter>
      <blacklist>
        <directory suffix=".php">./../../</directory>
        <file></file>
        <exclude>
          <file></file>
        </exclude>
      </blacklist>
      <whitelist processUncoveredFilesFromWhitelist="true">
          <directory suffix=".php">./../application/models</directory>
          <directory suffix=".php">./../application/controllers</directory>
          <directory suffix=".php">./../application/libraries</directory>
          <directory suffix=".php">./../application/helpers</directory>
        <file></file>
        <exclude>
          <directory suffix="index.php">./../application</directory>
          <file></file>
        </exclude>
      </whitelist>
    </filter>
</phpunit>