output of `codecept_relative_path()` incorrect when `codeception.yml` not in project root #3433

Closed
loren-osborn opened this Issue Aug 11, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@loren-osborn
Contributor

loren-osborn commented Aug 11, 2016

What are you trying to achieve?

I'm trying to read the filenames displayed in the stack trace when a test throws an exception, even when codeception.yml is include:ed from a subdirectory relative to the primary codeception.yml.

What do you get instead?

If the file path is not a subdirectory of the included directory, the beginning of the file path will be omitted. This filename is processed through codecept_relative_path() which does not account for this edge case.

Details

...
Time: 27.8 seconds, Memory: 29.50MB

There was 1 failure:

---------
1) CheckoutTestingScenarioCept: Log in as regular user
 Test  tests/acceptance/CheckoutTestingScenarioCept.php
 Step  Fail "Web server threw Exception"
 Fail  Web server threw Exception

Scenario Steps:

 6. $I->fail("Web server threw Exception") at xtensions/CatchExceptionOutput.php:155
 5. $I->click({"css":"#login-form button[type=submit]"}) at tests/acceptance/_steps/UserSteps.php:18
 4. $I->fillField("#LoginForm_password","*******") at tests/acceptance/_steps/UserSteps.php:17
 3. $I->fillField("#LoginForm_username","*******") at tests/acceptance/_steps/UserSteps.php:16
 2. $I->canSeeElement("#login-form") at tests/acceptance/_steps/UserSteps.php:15
 1. $I->amOnPage("/site/login") at tests/acceptance/_steps/UserSteps.php:14

...

In this case, I expect line 6. of the stack trace to read:

 6. $I->fail("Web server threw Exception") at ../_custom/Extensions/CatchExceptionOutput.php:155

...or possibly have all paths relative to proj/ instead of proj/tests/frontend/.

  • Codeception version: 2.2.3
  • PHP Version: PHP 5.5.9-1ubuntu4.17 (cli)
  • Operating System: Ubuntu 14.04.4 LTS x86_64 (within VirtualBox/Vagrant/Windows 10)
  • Installation type: Composer via Makefile
  • Suite configuration:

proj/codeception.yml:

include:
  - tests/frontend
  - tests/admin
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: 512M
extensions:
    enabled:
        - Codeception\Extension\RunFailed
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql

proj/tests/frontend/codeception.yml:

namespace: Frontend
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: 512M
extensions:
    enabled:
        - Codeception\Extension\RunFailed
        - Acme\Codeception\Extensions\CatchExceptionOutput
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql
@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Mar 12, 2017

Member

Fixed by #3434

Member

Naktibalda commented Mar 12, 2017

Fixed by #3434

@Naktibalda Naktibalda closed this Mar 12, 2017

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