【问题标题】:run all zend framework2 unit tests运行所有 zend framework2 单元测试
【发布时间】:2013-07-08 11:50:09
【问题描述】:

我正在尝试在 Jenkins 中为 Zend Framework 2 进行项目构建设置,我想为我正在编写的每个模块运行所有单元测试 - 但我不太清楚如何做到这一点?

每个模块都有自己的“测试”目录,我可以很好地运行每个模块的测试套件。我是否必须编写一些脚本来查找所有自定义模块并运行它们的测试?有没有人有一个很好的例子如何做到这一点?

【问题讨论】:

标签: unit-testing jenkins phpunit zend-framework2


【解决方案1】:

首先,让测试一起运行

我会尝试编写一个新的 phpunit 配置文件,比如 all.xml,给出不同测试文件的详细信息。

 <phpunit>
     <testsuite name="Module1">
          <directory>./module1</directory>
     </testsuite>
    <testsuite name="Module2">
          <directory>./module2</directory>
     </testsuite>
     <testsuite name="Module2">
          <directory>./module3</directory>
     </testsuite>
</phpunit>

测试这在命令行上运行是否正常

$ phpunit -c all.xml

添加到 Jenkins

只需将其添加到您的 Jenkins 配置中。下面是一个使用 Ant xml 文件的示例:

<target name="phpunit" description="Run unit tests with PHPUnit">
    <exec executable="phpunit" failonerror="true">
        <arg line=" -c tests/all.xml" />
    </exec>
</target>

【讨论】:

  • 也许有人知道如何使用这种结构向每个测试套件添加引导程序?
  • 我开始尝试 Jenkins,它会自动部署到 NGinx 还是在 ANT 中以某种方式配置?到目前为止,我在 PHP+Jenkin 模板教程中没有提到这一点。
猜你喜欢
  • 2023-04-06
  • 2013-07-29
  • 1970-01-01
  • 1970-01-01
  • 2020-05-05
  • 1970-01-01
  • 2015-01-09
  • 2013-02-04
  • 2023-03-21
相关资源
最近更新 更多