Skip to content

Success not reported if run with --repeat, uses @dataProvider and failed at first.#1

Open
PieterDC wants to merge 3 commits intoonly-repeat-failedfrom
repeat-onlyfailed-dataprovider-textuiresultprinter
Open

Success not reported if run with --repeat, uses @dataProvider and failed at first.#1
PieterDC wants to merge 3 commits intoonly-repeat-failedfrom
repeat-onlyfailed-dataprovider-textuiresultprinter

Conversation

@PieterDC
Copy link
Collaborator

While working on sebastianbergmann#1965 I discovered that when dataProvider is used with repeat, we can not rely on lastTestFailed from this class.
In ResultPrinter, after the test succeeded in the second run, lastTestFailed is on true while it should be false.
In TestResult, which calls the ResultPrinter listener, lastTestFailed is correctly false.
Does dataprovider mangle with that?

Added a test to a separate branch to uncover this bug.

The bug makes me think of sebastianbergmann#872 '--repeat breaks \PHPUnit_Framework_MockObject_Matcher_InvokedCount' because it's also some kind of count ...
Didn't have time to invest this further, our priority is on sebastianbergmann#1965.

The following workaround doesn't suffice although the "failed status" of the test looked more trustworthy than the one from PHPUnit_TextUI_ResultPrinter while step debugging:

public function endTest(PHPUnit_Framework_Test $test, $time)
{
    if (($test instanceof PHPUnit_Framework_TestCase && !$test->hasFailed()) || !$this->lastTestFailed) {

It makes a bunch of already existing tests fail. So, it needs work.

…with --only-repeat-failed on a test with a dataprovider that failed the first run but succeeds a next run. "F.SSS" shows instead of "F.S.SS".
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

Successfully merging this pull request may close these issues.

1 participant