【问题标题】:PHPUnit only runs first file in directoryPHPUnit 只运行目录中的第一个文件
【发布时间】:2012-08-20 01:31:15
【问题描述】:

在一个目录中我有两个文件

oneTest.php

<?php

class oneTest extends PHPUnit_Framework_TestCase {

    public function testSomethingOne()
    {
        echo 'ONE TEST';
        $this->assertEquals(1, 1);
    }

}

twoTest.php

<?php

class twoTest extends PHPUnit_Framework_TestCase {

    public function testSomethingTwo()
    {
        echo 'TWO TEST';
        $this->assertEquals(2, 2);
    }

}

从目录中我可以很好地运行两个测试

phpunit oneTest.php
phpunit twoTest.php

我在两者上都得到了预期的输出。

如果我尝试使用

运行所有测试
phpunit *

它只运行第一个测试。

我在 Ubuntu 12.04 上运行 phpunit 3.6.12。

任何想法为什么会发生这种情况?

谢谢

【问题讨论】:

    标签: phpunit


    【解决方案1】:

    这只是phpunit的一个限制,它没有被编程为支持命令行上的多个文件。但是,您可以pass a directory name to phpunit。如果要在当前目录中运行测试,请使用

    phpunit .
    

    编辑:或者,您可以在 XML configuration file 中指定一个测试套件。

    【讨论】:

      猜你喜欢
      • 2017-10-19
      • 2021-08-03
      • 2017-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-23
      • 2016-06-06
      • 2013-01-08
      相关资源
      最近更新 更多