Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failing to run Codeception tests with code coverage

Tags:

I'm getting an error when I try to run tests using the --coverage flag.


Input

php codecept.phar run acceptance testCest.php --coverage 

Output

[ErrorException] file_get_contents(http://project.local/c3/report/clear): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found 

codeception.yml

coverage:     remote: false     enabled: true     include:         - application/* 

public_html/index.php

<?php require __DIR__.'/../c3.php'; ?> 

Versions

PHP: 5.5.12 Xdebug: 2.5.0 Codeception: 2.0.7 

Thanks for any help!

J

like image 501
jastew Avatar asked Dec 22 '14 17:12

jastew


People also ask

What is PHP code coverage?

In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite.

Is Codeception a framework?

Codeception is a framework used for creating tests, including unit tests, functional tests, and acceptance tests.


1 Answers

  1. go to phpunit.xml and make sure you have something like this in the file:

    < logging >
    < log type="coverage-html" target="./CodeCoverage/"/>
    < /logging >

  2. run this command:

    $ phpunit --coverage-html ./report

  3. now check go to the directory and open the html file.

like image 99
Mahmoud Zalt Avatar answered Jan 01 '23 20:01

Mahmoud Zalt