New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceptance coverage generated 0 #4196

Closed
Zeika opened this Issue May 5, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@Zeika

Zeika commented May 5, 2017

Hello guys
My aim generates code coverage for acceptance test.
I heve:
php 5.6
selenium-server-standalone-2.53.1
yii2 advanced

C3.php Downloaded and put on frontend folder
https://raw.github.com/Codeception/c3/2.0/c3.php

codeception.yml

namespace: tests\codeception\frontend
actor: Tester
paths:
    tests: .
    log: _output
    data: _data
    helpers: _support
settings:
    bootstrap: _bootstrap.php
    suite_class: \PHPUnit_Framework_TestSuite
    colors: false
    memory_limit: 1024M
    strict_xml: true
    log: true
config:
    test_entry_url: 'http://127.0.0.1/index-test.php/'
coverage:
    enabled: true
    remote: true
    remote_context_options:
        http:
            timeout: 60
        ssl:
            verify_peer: false
    remote_config: ../tests/codeception.yml
    whitelist:
        include:
          - ../../../frontend/components/*.php
          - ../../../frontend/models/*.php
          - ../../../frontend/web/*.php
    c3_url: 'http://127.0.0.1/index-test.php/'

acceptance.suite.yml

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver
    config:
        PhpBrowser:
            url: http://127.0.0.1/
        WebDriver:
            url: http://127.0.0.1/
            browser: firefox
            delay: 1000
            wait: 5
            connection_timeout: 100
            request_timeout: 100
            windows_size: 800x600

index-test.php

<?php

// NOTE: Make sure this file is not accessible when deployed to production
if (!in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'])) {
    die('You are not allowed to access this file.');
}

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
include_once __DIR__ . '/../c3.php';
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = require(__DIR__ . '/../../tests/codeception/config/frontend/acceptance.php');

define('MY_APP_STARTED', true);

(new yii\web\Application($config))->run();

run test
codecept run acceptance --xml --html --coverage --coverage-xml --coverage-html

return this issue:

[PHPUnit_Framework_Exception]                                                                                                                                           
  file_put_contents(_PATHTOYIIAPP_\tests\codeception\frontend\_output\tests\codeception\frontend.acceptance.remote.coverage.xml): failed to open strea   
  m: No such file or directory 

How to change this directory?

I create directories _tests\codeception_ on the folder _output\

After creating the folder and run test

Code Coverage Report:                                                                                                                                                     
  2017-05-05 20:00:25                                                                                                                                                     
                                                                                                                                                                          
 Summary:                                                                                                                                                                 
  Classes:  5.24% (11/210)                                                                                                                                                
  Methods:  0.00% (0/838)                                                                                                                                                 
  Lines:    0.00% (0/30249)                                                                                                                                               
                                                                                                                                                                          
Remote CodeCoverage reports are not printed to console                                                                                                                    
                                                                                                                                                                          
HTML report generated in coverage                                                                                                                                         
XML report generated in coverage.xml

frontend.acceptance.remote.coverage.xml

<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1494001022">
  <project timestamp="1494001022">
    <metrics files="0" loc="0" ncloc="0" classes="0" methods="0" coveredmethods="0" conditionals="0"
	coveredconditionals="0" statements="0" coveredstatements="0" elements="0" coveredelements="0"/>
  </project>
</coverage>

Could you explain me, please what I do wrong?

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda May 5, 2017

Member

You don't need remote: true
It makes Codeception download code coverage report over HTTP, but your website runs on the same computer, so coverage files are accessible directly.
Change remote to false.
http://codeception.com/docs/11-Codecoverage#Local-Server

Member

Naktibalda commented May 5, 2017

You don't need remote: true
It makes Codeception download code coverage report over HTTP, but your website runs on the same computer, so coverage files are accessible directly.
Change remote to false.
http://codeception.com/docs/11-Codecoverage#Local-Server

@AvEL0N

This comment has been minimized.

Show comment
Hide comment
@AvEL0N

AvEL0N May 5, 2017

I have the same issue
cc
My site has many chapters
The chapter is a module yii2
How to generate coverage report look like

Chapter One covered
Chapter Two Uncovered

AvEL0N commented May 5, 2017

I have the same issue
cc
My site has many chapters
The chapter is a module yii2
How to generate coverage report look like

Chapter One covered
Chapter Two Uncovered
@AvEL0N

This comment has been minimized.

Show comment
Hide comment
@AvEL0N

AvEL0N May 5, 2017

What different between visualization code coverage unit, functional and accepting?

AvEL0N commented May 5, 2017

What different between visualization code coverage unit, functional and accepting?

@DavertMik

This comment has been minimized.

Show comment
Hide comment
@DavertMik
Member

DavertMik commented May 10, 2017

@DavertMik DavertMik closed this May 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment