Skip to content
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

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

@loren-osborn
Copy link
Contributor

@loren-osborn 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.