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

End test printer event is not called if previous test failed #4223

Closed
SvetlanaZem opened this issue May 17, 2017 · 2 comments
Closed

End test printer event is not called if previous test failed #4223

SvetlanaZem opened this issue May 17, 2017 · 2 comments

Comments

@SvetlanaZem
Copy link

  1. Create test suite where the first test will fail with cURL error 7: Failed to connect to localhost port 80: Connection refused, because no web server is running.
<?php
class MyPageCrudCest
{
    function viewPage(AcceptanceTester $I)
    {
        $I->amOnPage('/test.php');
    }

    function updatePage(AcceptanceTester $I)
    {
        // empty test
    }
}
  1. Implement custom ResultPrinter and override startTest and endTest methods.
class PhpStorm_Codeception_ReportPrinter extends PHPUnit_TextUI_ResultPrinter
{
    public function startTest(PHPUnit_Framework_Test $test)
    {
        $testName              = \Codeception\Test\Descriptor::getTestAsString($test);
        $this->write("\nSTARTED: $testName\n");
    }

    public function endTest(PHPUnit_Framework_Test $test, $time)
    {
        $testName              = \Codeception\Test\Descriptor::getTestAsString($test);
        $this->write("\nENDED: $testName\n");

    }
}
  1. Execute tests with custom result printer.

I expect to see both tests started and ended

STARTED: MyPageCrudCest: View page

ENDED: MyPageCrudCest: View page

STARTED: MyPageCrudCest: Update page

ENDED: MyPageCrudCest: Update page

What do you get instead?

The second test is started but not ended.

STARTED: MyPageCrudCest: View page

ENDED: MyPageCrudCest: View page

STARTED: MyPageCrudCest: Update page

Details

  • Codeception version: 2.2.11 (the issue is not reproducible with 2.2.10)
  • PHP Version: 7.1.1
  • Installation type: Composer
@Naktibalda
Copy link
Member

Does it even run the second test?

Probably this issue was caused by d24aa1e.

I have very limited time to work on Codeception (and a lot more to support it online), but I will try to look into this issue tonight.

@SvetlanaZem
Copy link
Author

@Naktibalda You are right, it looks like the second test is not executed at all.

Naktibalda added a commit to Naktibalda/Codeception that referenced this issue May 17, 2017
Fixed condition which is checking if error happened in before
Closes Codeception#4223
Naktibalda added a commit to Naktibalda/Codeception that referenced this issue May 17, 2017
Fixed condition which is checking if error happened in before
Closes Codeception#4223
DavertMik pushed a commit that referenced this issue May 20, 2017
Fixed condition which is checking if error happened in before
Closes #4223
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants