dongyanfeng0563 2018-12-03 11:02
浏览 96

Codeception验收测试报告覆盖率为0%

I'm trying to test my Yii2 application by codeception. I want to see coverage of my code. I'm running selenium server:

java -jar -Dwebdriver.chrome.driver=chromedriver /path/to/selenium-server-standalone-3.141.59.jar

And i'm running my test in the following way:

./vendor/bin/codecept run `tests/acceptance/callIn/FinishCallCest.php:submitBlank --coverage`

When I'm runinng codeception acceptance test without --coverage everything works fine. And if I'm running codeception unit tests with --coverage I get correctly coverage report.

But, if I run codeception acceptance test with --coverage I seeing following:

  1. localhost:8080 link opens in my browser. And i see "NOT FOUND 404" page from Yii2.
  2. Then redirect to http://localhost:8080/index-test.php?r=call-in%2Ffinish-call&callId=1 happens, and I see the page and test is successfully done.

Why does the localhost:8080 page load first? And how can I fix the error with 0% coverage?

Here's my codeception.yml

actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    helpers: tests/_support
settings:
    bootstrap: _bootstrap.php
    memory_limit: 1024M
    colors: true
modules:
    config:
        Yii2:
            configFile: 'config/test.php'
            cleanup: false
coverage:
    c3_url: http://127.0.0.1:8080/index-test.php/
    enabled: true
    whitelist:
        include:
            - models/*
            - controllers/*
config:
    test_entry_url: http://localhost:8080/idnex-test.php  

Here's my acceptance.suite.yml

class_name: AcceptanceTester
modules:
    enabled:
        - Yii2:
            part: [orm] # allow to use AR methods
            cleanup: false
        - WebDriver:
            url: 'http://test:test@localhost:8080'
            auth: ['test', 'test']
            browser: chrome
            restart: true
            window_size: 1024x768  

And here's a codeception test log:

Acceptance Tests (1) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modules: Yii2, WebDriver
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FinishCallCest: Submit blank finish form
Signature: calIn\FinishCallCest:submitBlankFinishForm
Test: tests/acceptance/callIn/FinishCallCest.php:submitBlankFinishForm
Scenario --
  Destroying application
  Starting application
  [ConnectionWatcher] watching new connections
  [Fixtures] Loading fixtures
  [Fixtures] Done
  [GET] http://test:test@localhost:8080/
  [Cookies] [{"domain":"localhost","httpOnly":true,"name":"_csrf","path":"/","secure":false,"value":"c99eee70d806de0660302db950c436a04f5a6316b5847caed6de7d1d2e2d896aa%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22PXMEKYNF-k-StsR38slXolelVVLuFKTK%22%3B%7D"},{"domain":"localhost","expiry":1543848123.606772,"httpOnly":true,"name":"_identity","path":"/","secure":false,"value":"dacb46519512cd901d6c8ceafb494a3d2893b6cf41a196e111c9c522aa4605c9a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A77%3A%22%5B%22corebofs000080000ktnhd8g9vnbio68%22%2C%22corebofs000080000ktnhd8g9vnbio68%22%2C18000%5D%22%3B%7D"},{"domain":"localhost","httpOnly":true,"name":"PHPSESSID","path":"/","secure":false,"value":"06okm3re6q6ncjj6q878sdq88j"}]
 I am on page "/index-test.php?r=call-in%2Ffinish-call&callId=1"
  [GET] http://test:test@localhost:8080/index-test.php?r=call-in%2Ffinish-call&callId=1
 I wait 5
 I click "//*[@id="w3"]/div[1]/div[1]/h4/a"
 I wait 5
 I see "Завершение звонка","//*[@id="w1"]/div[4]/button"
 I click "//*[@id="w1"]/div[4]/button"
 PASSED 

  Destroying application
  [ConnectionWatcher] no longer watching new connections
  [ConnectionWatcher] closing all (0) connections
  Suite done, restoring $_SERVER to original
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Time: 24.18 seconds, Memory: 14.00MB

OK (1 test, 1 assertion)


Code Coverage Report:     
  2018-12-03 09:42:01     

 Summary:                 
  Classes:  0.00% (0/84)  
  Methods:  0.00% (0/389) 
  Lines:    0.00% (0/2706)

Remote CodeCoverage reports are not printed to console

HTML report generated in coverage
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)