You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
protected function runTest() in PHPUnit\Framework\TestCase provided an extension point to change the actual run implementation. That enabled various use-cases around exception handling and specialized test execution.
One additional use-case that has not been mentioned yet is to retry tests that might be unstable.
It would be terrific if PHPUnit could provide an officially blessed extension point to change test execution.
That enabled various use-cases around exception handling and specialized test execution.
I am not sure what you mean with "exception handling" here, but TestCase::registerFailureType() can be used to register additional exception types that should be treated as an assertion failure instead of as an error.
This is an example of our approach with TestCase::run(), TestCase::runBase(), and TestCase::runTest(). These methods are either declared final and marked as internal and therefore not covered by the backward compatibility promise for PHPUnit or they are declared private. It was possible to overwrite them in the past, which caused all sorts of problems. Instead, and where it is sensible, we provide methods such as the aforementioned TestCase::registerFailureType() for customizing very specific aspects of running a test.
It would be terrific if PHPUnit could provide an officially blessed extension point to change test execution.
I do not see how this would be possible without causing more problems than this would be worth.
One additional use-case that has not been mentioned yet is to retry tests that might be unstable.
protected function runTest()
inPHPUnit\Framework\TestCase
provided an extension point to change the actual run implementation. That enabled various use-cases around exception handling and specialized test execution.One additional use-case that has not been mentioned yet is to retry tests that might be unstable.
It would be terrific if PHPUnit could provide an officially blessed extension point to change test execution.
See related issues:
runTest
function #6172Here is an example of how
runTest
was used for a retry implementation:The text was updated successfully, but these errors were encountered: