Yii Framework Forum: Code Coverage Issue - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Code Coverage Issue yii2 + codeception : can't get code coverage to work Rate Topic: -----

#1 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 637
  • Joined: 29-November 08
  • Location:Paris, France

Posted 26 April 2014 - 12:52 PM

Hi,
I can't get code coverage to work ! I run following command :

codecept.bat run --coverage unit


All tests are ok (no error) and the following message is displayed :

Code Coverage Report
  2014-04-26 17:36:13

 Summary:
  Classes:  (0/0)
  Methods:  (0/0)
  Lines:	(0/0)


No error but no code coverage neither !

The codeception.yml file contains :

coverage:
	enable: true


... but no report is created. I tried to create a simple phpunit test case and run it with Phpunit (not codeception) and in this case, yes, the coverage report is generated successfully.

Any idea/hint/clue/advice I could use to fix this problem ?
Thanks in advance

B)
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 26 April 2014 - 04:33 PM

You need XDebug with coverage turned on.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 637
  • Joined: 29-November 08
  • Location:Paris, France

Posted 27 April 2014 - 09:35 AM

Yes, I have XDebug turned on.

I made a test with only one unit test : SomeTest.php

When I run unit test using phpunit : coverage report is created

$ phpunit.bat --coverage-html ./_log/coverage  unit/SomeTest.php
PHPUnit 3.7.34 by Sebastian Bergmann.

Configuration read from F:\Project\ws1\yii2-basic\app\tests\phpunit.xml.dist
.
Time: 593 ms, Memory: 5.25Mb
OK (1 test, 1 assertion)
Generating code coverage report in HTML format ... done


When I run unit test using codeception : no coverage report is created

$ codecept.bat run --coverage unit
Codeception PHP Testing Framework v1.8.5
Powered by PHPUnit 3.7.34 by Sebastian Bergmann.

Unit Tests (1) ------------------------------
Running tests\unit\SomeTest::testMe 	Ok
---------------------------------------------

Time: 1.32 seconds, Memory: 8.25Mb

OK (1 test, 1 assertion)

Code Coverage Report
  2014-04-27 14:02:01

 Summary:
  Classes:  (0/0)
  Methods:  (0/0)
  Lines:	(0/0)


I don't understand what I missed ...

B)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users