EcomDev Phpunit tests called twice at run time

I try to run several unit test cases, and I see that they run twice in each run, but I'm not sure about this reason.

Below is the structure of my test -

class Sample_Module_Test_Model_HelloserviceTest extends EcomDev_PHPUnit_Test_Case{ public function testHelloworld(){ Mage::log("Hello world!"); } } 

And, I am doing a test

  phpunit --group Sample_Module 

This is what i see

 PHPUnit 3.7.22 by Sebastian Bergmann. Configuration read from /mnt/www/dev.giftcardmall.com/phpunit.xml.dist ...... Time: 2 seconds, Memory: 26.75Mb OK (2 tests, 0 assertions) 

Also in the log, I see that Hello world is printed twice every time it runs.

I'm not sure where I am wrong ... any help would be greatly appreciated.

+4
source share
2 answers

Most likely you are running tests due to invalid arguments, such as:

 phpunit -c tests/ -c tests/phpunit.xml 
0
source

Better late than never. I had the same problem, but I just bother to investigate.

In my case, I had the wrong groups defined in my config.xml file. I had groups defined in singular node, but they must be plural. Therefore, instead of:

 <phpunit> <suite> <modules> <Module_Name /> </modules> <groups> <model>Model</model> <helper>Helper</helper> <block>Block</block> </groups> </suite> </phpunit> 

It should be:

 <phpunit> <suite> <modules> <Module_Name /> </modules> <groups> <models>Model</models> <helpers>Helper</helpers> <blocks>Block</blocks> </groups> </suite> </phpunit> 

But you can also just leave node groups. You really need it only if you have tests in another directory.

0
source

Source: https://habr.com/ru/post/1495441/


All Articles