2013-02-21 13 views
7

PHPUnit में के लिए यह अलग testsuites में टेस्ट का आयोजन करने के लिए posible है: जैसेPHPUnit: फ़िल्टर केवल एक testsuite

<phpunit bootstrap="Bootstrap.php"> 
    <testsuites> 
     <testsuite name="zf2sandbox"> 
      <directory>./AlbumTest</directory> 
     </testsuite> 
    </testsuites> 
</phpunit> 

इसके अलावा आप परिभाषित कर सकते हैं फिल्टर अब मैं संयोजित करना चाहते हैं इन दो भ्रूण। filter टैग को testsuite में फ़िल्टर करने की अनुमति नहीं है (फ़िल्टर को केवल अनदेखा किया गया है)।

<phpunit bootstrap="Bootstrap.php"> 
    <testsuites> 
     <testsuite name="zf2sandbox"> 
      <directory>./AlbumTest</directory> 
      <filter> 
       <whitelist> 
        <directory suffix=".php">/var/www/sandbox/zf2sandbox/module/Album/src/Album/</directory> 
       </whitelist> 
      </filter> 
     </testsuite> 
    </testsuites> 
</phpunit> 

वहाँ एक और तरीका प्रत्येक testsuite के लिए फिल्टर (whilists, काली सूची आदि) को परिभाषित करने के है?

उत्तर

1

क्या आपने testsuite टैग के अंदर filter जोड़ने का प्रयास किया था, क्योंकि आपके उदाहरण में यह testsuites टैग में है। यानी:

<phpunit bootstrap="Bootstrap.php"> 
    <testsuites> 
     <testsuite name="zf2sandbox"> 
      <directory>./AlbumTest</directory> 
      <filter> 
       <whitelist> 
        <directory suffix=".php">/var/www/sandbox/zf2sandbox/module/Album/src/Album/</directory> 
       </whitelist> 
      </filter> 
     </testsuite> 
    </testsuites> 
</phpunit> 
+0

धन्यवाद! मैंने अपनी पोस्ट संपादित की है। नहीं, यह काम नहीं कर रहा है। – automatix

+1

मुझे नहीं लगता कि यह PHPUnit द्वारा समर्थित है, यह भी देखें [प्रश्न] (http://stackoverflow.com/questions/13672946/codecoverage-with-phpunit-not- जनरेटिंग) –