Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unit testing PHPUnit不';不要加载一些测试_Unit Testing_Magento_Phpunit - Fatal编程技术网

Unit testing PHPUnit不';不要加载一些测试

Unit testing PHPUnit不';不要加载一些测试,unit-testing,magento,phpunit,Unit Testing,Magento,Phpunit,我的一个模块中有一个测试文件夹,其中包含3个子文件夹: Model Helper Integration 运行 phpunit --group My_Module 仅执行Model和Helper目录中的测试,集成文件夹保持不变。在所有情况下,测试文件都直接驻留在文件夹中,因此我不确定是什么导致了问题。 以下是我的phpunit.xml: <?xml version="1.0"?> <!-- initial phpunit configuration file, that

我的一个模块中有一个测试文件夹,其中包含3个子文件夹:

Model
Helper
Integration
运行

phpunit --group My_Module 
仅执行Model和Helper目录中的测试,集成文件夹保持不变。在所有情况下,测试文件都直接驻留在文件夹中,因此我不确定是什么导致了问题。 以下是我的phpunit.xml:

<?xml version="1.0"?>
<!-- initial phpunit configuration file, that you can modify for your project needs -->
<phpunit cacheTokens="true"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         strict="false"
         verbose="false"
         bootstrap="app/code/community/EcomDev/PHPUnit/bootstrap.php">
    <listeners>
        <listener file="app/code/community/EcomDev/PHPUnit/Test/Listener.php" class="EcomDev_PHPUnit_Test_Listener" />
    </listeners>
    <testsuites>
        <testsuite name="MyApp">
            <directory suffix=".php">app/code/local/*/*/Test/*/</directory>
        </testsuite>
        <testsuite name="Magento Test Suite">
            <file>app/code/community/EcomDev/PHPUnit/Test/Suite.php</file>
        </testsuite>
    </testsuites>
    <filter>
        <blacklist>
            <!-- Exclude Magento Core files from code coverage -->
            <directory suffix=".php">app/code/core</directory>
            <!-- Exclude EcomDev_PHPUnit classes from code coverage -->
            <directory suffix=".php">app/code/community/EcomDev/PHPUnit</directory>
            <directory suffix=".php">lib/EcomDev/Utils</directory>
            <directory suffix=".php">lib/EcomDev/PHPUnit</directory>
            <directory suffix=".php">lib/Spyc</directory>
            <directory suffix=".php">lib/vfsStream</directory>
            <!-- Exclude Mage.php file from code coverage -->
            <file>app/Mage.php</file>
            <!-- Exclude template files -->
            <directory suffix=".phtml">app/design</directory>
            <!-- Exclude Varien & Zend libraries -->
            <directory suffix=".php">lib/Varien</directory>
            <directory suffix=".php">lib/Zend</directory>
        </blacklist>
    </filter>
    <logging>
        <!-- Uncomment this line if you want to have coverage report generated every test run
        <log type="coverage-html" target="var/phpunit/coverage" charset="UTF-8"
              yui="true" highlight="false"
              lowUpperBound="35" highLowerBound="70"/>
        <log type="coverage-clover" target="var/phpunit/coverage.xml"/>
        -->
        <log type="junit" target="../build/logs/junit.xml" logIncompleteSkipped="false"/>
    </logging>
</phpunit>

app/code/local/*/*/测试/*/
app/code/community/EcomDev/PHPUnit/Test/Suite.php
应用程序/代码/核心
app/code/community/EcomDev/PHPUnit
lib/EcomDev/Utils
lib/EcomDev/PHPUnit
lib/Spyc
lib/vfstream
app/Mage.php
应用程序/设计
lib/Varien
lib/Zend
我在ubuntu虚拟机上运行的PHPunit版本是3.7.28。如何运行所有测试?非常感谢您的帮助

试着打电话

phpunit --list-groups
这将显示可用测试组的列表。您在列表中看到我的模块了吗?
1) 是-在测试文件夹/结构中发布。

2) 否-xml配置中存在问题。

是否将“集成”中的测试添加到我的模块组中?是的。同样奇怪的是,Model和Helper中的测试也有组标记,因此不确定这两个文件夹之间有什么不同。如果将“Integration”重命名为“Controller”或其他符合Magento结构的名称,是否会保持这种状态?我可以看到模块,它在上面提到的文件夹中运行测试,但不在集成文件夹中。有点愚蠢的问题,但是:您在测试中设置了组注释吗?/***@组集成*/public function testSomeIntegrationFunctionality(){…}EcomDev是否需要设置@group注释?我想您可以通过编辑modules
etc/config.xml
文件来节省这些资源。