【问题标题】:Empty code coverage空代码覆盖率
【发布时间】:2017-05-03 15:37:51
【问题描述】:

我正在尝试使用 codeception 为我的单元测试获取代码覆盖率。

当我在做 vendor/bin/codecept run unit --coverage 时,它会显示:

  Classes:  0.00% (0/1) 
  Methods:  0.00% (0/3) 
  Lines:    0.00% (0/28)

虽然我已经测试了 1 种方法而不是 3 种方法。

我用coverage_enable=On安装了xdebug

这是我的 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
extensions:
    enabled:
        - Codeception\Extension\RunFailed
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql
coverage:
    enable: true
    remote: false
    include:
        - Simplifier/*
    exclude:
        - vendor/*

我正在尝试测试 Simplifier/Routing.php

测试没问题,但我的覆盖范围错了。

知道为什么吗?

谢谢。

【问题讨论】:

    标签: php phpunit code-coverage codeception


    【解决方案1】:

    您在设置名称时犯了错误。

    enable: true 更改为enabled: true,代码覆盖率收集将起作用。
    http://codeception.com/docs/11-Codecoverage#Configuration

    【讨论】:

    • 它必须回到这个答案 3 次才能最终认识到差异是什么。
    猜你喜欢
    • 2012-06-30
    • 2018-01-11
    • 1970-01-01
    • 2016-11-29
    • 2012-05-04
    • 2018-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多