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

Tests with Exceptions are marked as broken #45

Closed
techhemant opened this issue Nov 7, 2019 · 3 comments
Closed

Tests with Exceptions are marked as broken #45

techhemant opened this issue Nov 7, 2019 · 3 comments

Comments

@techhemant
Copy link

techhemant commented Nov 7, 2019

Status of a failing test is marked as broken by this adapter in the xmls under allure-results. Which results in test shown as broken instead of failed in the report.

I'm using "allure-framework/allure-phpunit": "1.3.0" and allure command line version 2.13.0

Screen Shot 2019-11-07 at 1 28 43 pm

Screen Shot 2019-11-07 at 1 25 14 pm

@eduard-sukharev
Copy link

One should not throw exceptions to fail a test, but rather use special asserting tools to either check results of test, or expect an exception (thus, catching it but not allowing test suite to fail due to unhandled test exception).
Some code would help to clarify, though.

@techhemant
Copy link
Author

techhemant commented Nov 9, 2019

You're right. Perhaps, we're passing custom exception in parent::onNotSuccessfulTest($newException); is causing test to appear broken instead of failed.

We use

public function onNotSuccessfulTest(Throwable $e){

        $newException = new \Exception(
            $e->getMessage()
            . "\n" . $e->getTraceAsString(),
            0
        );

       parent::onNotSuccessfulTest($newException);
}

@techhemant
Copy link
Author

It seems this was the issue with my framework code. Closing the issue.

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