Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeception coverage report is empty though the test runs

enter image description herecodeception.yml configuration :

paths:
    tests: src/Niwa/ForecastUIBundle/Tests/codecept/test
    log: app/logs/report
    data: src/Niwa/ForecastUIBundle/Tests/codecept/test/_data
    helpers: src/Niwa/ForecastUIBundle/Tests/codecept/test/_helpers
settings:
    bootstrap: _bootstrap.php
    suite_class: \PHPUnit_Framework_TestSuite
    colors: true
    memory_limit: 1024M
    log: true

coverage:
    enable: true
    remote: true
    include:
        - src/Niwa/ForecastUIBundle
        - src/Niwa/ForecastRestBundle

my acceptance.suite.yml file configuration :

# Codeception Test Suite Configuration

# suite for acceptance tests.
# perform tests in browser using the Selenium-like tools.
# powered by Mink (http://mink.behat.org).
# (tip: that's what your customer will see).
# (tip: test your ajax and javascript by one of Mink drivers).

# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.

class_name: WebGuy
modules:
    enabled:
        - PhpBrowser
        - WebHelper
        - WebDebug
    config:
        PhpBrowser :
         url: 'http://forecast.localhost'

        capabilitites:
          unexpectedAlertBehaviour: 'accept'

command i am running to get the coverage :

php ./codecept.phar run --coverage --xml --html --report

output :

Codeception PHP Testing Framework v1.8.3
Powered by PHPUnit 3.7.28 by Sebastian Bergmann.
test the big number page (BigNumberTestCept.php)...........................Ok
display niwa forecast chart (ForecastChartCept.php)........................FAIL
check the resize algorithm (ForecastChartResizeCept.php)...................Ok
test the resize algorithm (LandingPageCept.php)............................FAIL


Code Coverage Report 
  2014-04-14 16:09:02

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

it is giving the index.html with all the classes and methods as blank. not generating any report.

Please help !!!

like image 603
shab Avatar asked Oct 20 '25 22:10

shab


2 Answers

Set coverage.remote to false. If you test locally, you don't need to have remote on true.

As I have seen your issue on GitHub https://github.com/Codeception/Codeception/issues/976 and you have c3.php in project root. In my case I had a problem if I have c3.php file in project root or in web root. I had to move this file to other directory, because during code coverage Codeception does requests on /c3/* paths and if I had c3.php file in project root or web directory, these paths didn't work for me.

like image 52
Jakub Zapletal Avatar answered Oct 24 '25 05:10

Jakub Zapletal


So I believe the problem is with the command line (bug in codeception)

php ./codecept.phar run --coverage --xml --html --report

I could not get --xml and --html and --report to produce a report. I'm using Jenkins so for that I use

php ./codecept.phar run --coverage --xml

For local development

php ./codecept.phar run --coverage --html

Then I can review the the HTML report in _log/report.html and _log/coverage/index.html

like image 41
Clutch Avatar answered Oct 24 '25 07:10

Clutch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!