我已经对我的应用程序模块和其他模块进行了测试。它们工作正常,但我想运行所有测试(应用程序模块和其他模块(以生成 jenkins 的三叶草报告。我该怎么办??创建另一个配置文件以调用其他配置文件??
---编辑---
我为每个模块引导程序使用相同的代码.php我想为每个模块使用相同的代码以避免代码重复。现在我有两个模块应用程序与问题,当我运行phpunit时,它抛出此错误:
**.PHP Fatal error: Class 'ProblemTest'Bootstrap' not found ....**
应用程序模块的测试工作正常,但问题模块的测试不适用于phpunit_bootstrap.php文件中的命名空间声明。
我的应用程序测试使用此声明:
<?php
namespace ApplicationTest'Controller;
use ApplicationTest'Bootstrap; ....
我的问题 tes 使用此声明:
<?php
namespace ProblemTest'Controller;
use ProblemTest'Bootstrap;
这是我的phpunit.xml
<phpunit bootstrap="phpunit_bootstrap.php">
<testsuites>
<testsuite name="ALL">
<directory>module/Application/test</directory>
<directory>module/Problem/test</directory>
</testsuite>
</testsuites>
这是我的phpunit_bootstrap.php
<?php
namespace ApplicationTest;
我现在必须运行所有测试的问题是,如何为每个测试包含相同的引导程序以避免该异常。
您可以创建一个测试套件来一次运行一堆单独的测试组。在你的phpunit.xml.dist文件中:
<phpunit bootstrap="phpunit_bootstrap.php">
<testsuites>
<testsuite name="all">
<directory>./</directory>
</testsuite>
<testsuite name="ALL">
<directory>/path/to/module1tests</directory>
<directory>/path/to/module2tests</directory>
<directory>/path/to/module3tests</directory>
<exclude>/path/to/module4tests</exclude>
</testsuite>
<testsuite name="module1only">
<directory>./module1tests</directory>
</testsuite>
</testsuites>
然后你可以用:/path/to/phpunit --testsuite="ALL"来运行它。
我还不能发表评论,所以这个问题的另一个解决方案可以在 zend 框架 2 + phpunit + 多个模块 + 持续集成 如果您不想单独命名每个模块。