Reputation: 2608
I am trying to run few unit test cases and I see that they are being run twice in each run, I am not sure of the reason though.
The following is my test case structure -
class Sample_Module_Test_Model_HelloserviceTest extends EcomDev_PHPUnit_Test_Case{
public function testHelloworld(){
Mage::log("Hello world!");
}
}
And, I execute the test by
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 Hello world printed twice on every execution.
I am not sure where I am going wrong...any help would be greatly appreciated.
Upvotes: 5
Views: 595
Reputation: 1614
Better late than never. I had the same problem, but only now bothered to investigate.
In my case I had the wrong groups defined in my config.xml. I had my groups defined in singular node names, but they should be plural. So 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 could also just leave the groups node out. You only actually need it if you have your tests in another directory.
Upvotes: 0
Reputation: 32280
You are most probably executing the tests due to incorrect arguments like:
phpunit -c tests/ -c tests/phpunit.xml
Upvotes: 0