2014-01-30 67 views
3

我在我的模塊中的一個有一個測試文件夾中,以3子文件夾:PHPUnit的不加載一些測試

Model 
Helper 
Integration 

運行

phpunit --group My_Module 

僅執行模式和輔助測試目錄,集成文件夾保持不變。測試文件直接存在於所有情況下的文件夾中,所以我不確定是什麼導致了這個問題。 這裏是我的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> 

的PHPUnit的版本,我的Ubuntu上運行虛擬機是28年7月3日。我怎樣才能讓所有的測試運行?幫助將不勝感激。

+0

您是否已將「集成」中的測試添加到My_Module組? – SenseException

+0

是的,我做到了。奇怪的是,模型和助手中的測試也有組標記,因此不確定兩個文件夾之間有什麼不同。 –

+1

如果您將「集成」重命名爲「控制器」或符合Magento-Structure的其他名稱,它會保持嗎? – LeMike

回答

2

嘗試調用

phpunit --list-groups 

這個節目您可用的測試組的列表。你在列表中看到My_Module嗎?
1)是 - 在測試文件夾/結構中出現問題。
2)否 - xml配置中的問題。

+0

我可以看到模塊,它在上述文件夾中運行測試,但不在Integration文件夾中運行。 –

+0

有點愚蠢的問題,但是:你在測試中設置組註釋嗎?/** * @group集成 */ public function testSomeIntegrationFunctionality(){...} http://phpunit.de/manual/4.1/en/appendixes.annotations.html#appendixes.annotations.group – ToxaBes

+0

是嗎? EcomDev需要設置@group註釋嗎?我認爲你可以通過編輯模塊'etc/config.xml'文件來節省空間。 – hakre