symfony - 尽管测试运行,代码接收覆盖率报告为空

标签 symfony phpunit code-coverage codeception

enter image description here codeception.yml配置:

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

我的acceptance.suite.yml文件配置:

# 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'

我正在运行命令来获取覆盖范围:

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

输出:

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)

它将所有类和方法的index.html 都显示为空白。不生成任何报告。

请帮忙!!!

最佳答案

将coverage.remote设置为false。如果您在本地测试,则不需要将远程设置为 true。

正如我在 GitHub 上看到的你的问题 https://github.com/Codeception/Codeception/issues/976并且项目根目录中有 c3.php 。就我而言,如果项目根目录或 Web 根目录中有 c3.php 文件,我就会遇到问题。我必须将此文件移动到其他目录,因为在代码覆盖期间 Codeception 会在/c3/* 路径上发出请求,并且如果我在项目根目录或 Web 目录中有 c3.php 文件,这些路径对我不起作用。

关于symfony - 尽管测试运行,代码接收覆盖率报告为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23051939/

相关文章:

python - hudson "Source code is unavailable."

php - symfony 路由重定向到登录页面

php - Symfony2 子域路由 - 不同的包

php - PHP : simpletest, phpunit 或哪个单元测试框架?

unit-testing - VS2010(专业版)的所有免费集成代码覆盖工具

code-coverage - llvm-cov:未实例化函数的统计信息

validation - 在 Sonata Admin 中声明唯一验证

php - Symfony 控制台 - 创建文件?

PHPUnit 4.8模拟mysql数据库接口(interface)

phpunit - "headers already sent"PHPUnit 测试期间返回错误