Codeception: Disable remote coverage not work

Created on 5 Nov 2013  Â·  17Comments  Â·  Source: Codeception/Codeception

codeception.yml:

coverage:
    enabled: true
    remote: false

output:

[ErrorException]
file_get_contents(http://localhost/c3/report/clear): failed to open str
eam: HTTP request failed! HTTP/1.1 404 Not Found
BUG

All 17 comments

no, i just want disabling any coverage via http

2013/11/19 Mitchel [email protected]

Is your RewriteRule on?

—
Reply to this email directly or view it on GitHubhttps://github.com/Codeception/Codeception/issues/655#issuecomment-28779268
.

@AlexEllo please confirm it's been fixed for you

I think not

yml:

class_name: TestGuy
modules:
    error_level: "E_ALL"
    enabled: [PhpBrowser,TestHelper]
    config:
        PhpBrowser:
            url: 'http://127.0.0.1'
coverage:
    enabled: true
    remote: false

php codecept.phar run --coverage -vvv

Modules: PhpBrowser, TestHelper
----------------------------------------------------------------------



  [ErrorException]
  file_get_contents(http://127.0.0.1/c3/report/clear): failed to open str
  eam: HTTP request failed! HTTP/1.1 404 Not Found




Exception trace:
 () at phar://codecept.phar/src/Codeception/Subscriber/CodeCoverage.php:102
 Codeception\Subscriber\ErrorHandler->errorHandler() at n/a:n/a
 file_get_contents() at
phar://codecept.phar/src/Codeception/Subscriber/CodeCoverage.php:102
 Codeception\Subscriber\CodeCoverage->getRemoteCoverageFile() at
phar://codecept.phar/src/Codeception/Subscriber/RemoteCodeCoverage.php:51
 Codeception\Subscriber\RemoteCodeCoverage->beforeSuite() at n/a:n/a
 call_user_func() at
phar://codecept.phar/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at
phar://codecept.phar/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at
phar://codecept.phar/src/Codeception/SuiteManager.php:141
 Codeception\SuiteManager->run() at
phar://codecept.phar/src/Codeception/Codecept.php:130
 Codeception\Codecept->runSuite() at
phar://codecept.phar/src/Codeception/Command/Run.php:124
 Codeception\Command\Run->runSuites() at
phar://codecept.phar/src/Codeception/Command/Run.php:92
 Codeception\Command\Run->execute() at
phar://codecept.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
 Symfony\Component\Console\Command\Command->run() at
phar://codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:897
 Symfony\Component\Console\Application->doRunCommand() at
phar://codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at
phar://codecept.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at
phar://codecept.phar/codecept:29
 require_once() at codecept.phar:7

Hmm... It's not in phar, since it hasn't been announced(released) yet. Can you check with composer?

Sent from my Galaxy Nexus

this test via composer:

composer install bla bla bla

class_name: WebGuy
modules:
    enabled:
        - PhpBrowser
        - WebHelper
    config:
        PhpBrowser:
            url: 'http://localhost/myapp/'
coverage:
    enabled: true
    remote: false 
php codecept generate:cept acceptance test
php codecept run acceptance --coverage -vvv
Acceptance Tests (1) ----------------------------------------------
Modules: PhpBrowser, WebHelper
-------------------------------------------------------------------



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




Exception trace:
 () at C:\temp\Codeception\src\Codeception\Subscriber\CodeCoverage.php:115
 Codeception\Subscriber\ErrorHandler->errorHandler() at n/a:n/a
 file_get_contents() at C:\temp\Codeception\src\Codeception\Subscriber\CodeCoverage.php:115
 Codeception\Subscriber\CodeCoverage->getRemoteCoverageFile() at C:\temp\Codeception\src\Codeception\Subscriber\RemoteCodeCoverage.php:51
 Codeception\Subscriber\RemoteCodeCoverage->beforeSuite() at n/a:n/a
 call_user_func() at C:\temp\Codeception\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:164
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at C:\temp\Codeception\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:53
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at C:\temp\Codeception\src\Codeception\SuiteManager.php:147
 Codeception\SuiteManager->run() at C:\temp\Codeception\src\Codeception\Codecept.php:152
 Codeception\Codecept->runSuite() at C:\temp\Codeception\src\Codeception\Codecept.php:130
 Codeception\Codecept->run() at C:\temp\Codeception\src\Codeception\Command\Run.php:125
 Codeception\Command\Run->runSuites() at C:\temp\Codeception\src\Codeception\Command\Run.php:93
 Codeception\Command\Run->execute() at C:\temp\Codeception\vendor\symfony\console\Symfony\Component\Console\Command\Command.php:244
 Symfony\Component\Console\Command\Command->run() at C:\temp\Codeception\vendor\symfony\console\Symfony\Component\Console\Application.php:897
 Symfony\Component\Console\Application->doRunCommand() at C:\temp\Codeception\vendor\symfony\console\Symfony\Component\Console\Application.php:191
 Symfony\Component\Console\Application->doRun() at C:\temp\Codeception\vendor\symfony\console\Symfony\Component\Console\Application.php:121
 Symfony\Component\Console\Application->run() at C:\temp\Codeception\codecept:29

What version is this?

Sent from my Galaxy Nexus

in 1.8.0
and master

@AlexEllo thanks, it turns out there is one more place to be fixed :-(

Ok, I merged @tiger-seo fixes. Can anyone confirm this works now (as you see these are 1.7, 1.6 branches), or something else required?

1.8 and master yet has to come, patience ;-)

@AlexEllo please confirm that this one is fixed

@tiger-seo yep, it works

Cool :-)

Sent from my Galaxy Nexus

2.1.2, same situation

2.1.2, same situation:

$ vendor/bin/codecept run --coverage --coverage-html
Codeception PHP Testing Framework v2.1.2
Powered by PHPUnit 4.8.4 by Sebastian Bergmann and contributors.
Unit Tests (1) ----------------------------------------------------------------------
UnitTest\FixedAssets\Controller\User\ComputersControllerTest::testList         Ok
Functional Tests (0) ------------------------
Acceptance Tests (0) ------------------------                                                                                                                              
  [PHPUnit_Framework_Exception]                                                                                                  
  file_get_contents(http://localhost/myapp/c3/report/clear): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found  

My codeception.yml:

actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    support: tests/_support
    envs: tests/_envs
settings:
    bootstrap: _bootstrap.php
    colors: true
    memory_limit: 1024M
coverage:
    enabled: true
    remote: false
    whitelist:
        include:
            - module/*
extensions:
    enabled:
        - Codeception\Extension\RunFailed
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql

you get URL from acceptance suite??
when i set

modules:
    enabled:
        - PhpBrowser:
            url: http://localhost:8080

all works

for all: if you want use coverage? you must:

  1. download and install c3.php (https://github.com/Codeception/c3), even you use PHP internal webserver
  2. set url in acceptance.suite.yml like this:

    modules:
    enabled:
       - PhpBrowser:
           url: http://localhost:8080  // url to your app
    
  3. add to you codeception.yml:

    coverage:
    enabled: true
    remote: false
    
  4. run

    $ vendor/bin/codecept run --coverage --coverage-html
    

when you can see HTML coverage report in tests/_output/coverage directory.

Why url readed from acceptance.suite.yml ?
What i must run coverage report if in my project not exists acceptance tests ?

In reply to @maxgu, it's not necessary to download c3.php if you're just doing unit tests. Add "unit" (without quotes) to your command line options and it will just run your unit tests, bypassing the acceptance tests and therefore not trying to use c3.php.

Was this page helpful?
0 / 5 - 0 ratings