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

Repeat failed tests #2433

Closed
rentalhost opened this issue Jan 23, 2017 · 4 comments
Closed

Repeat failed tests #2433

rentalhost opened this issue Jan 23, 2017 · 4 comments
Labels
type/enhancement A new idea that should be implemented

Comments

@rentalhost
Copy link

It's a complement for #1022 closed by 5.0 version.

I guess that a command line like --repeat should be useful to try first lasts failed tests.

It should works like that: when you run phpunit, it'll create a temporary file that should have the info about any failed tests (basically: class and test name and test index if it uses a data provider).

[
    { "class": "MyTest", "method": "testSingle", "index": null },
    { "class": "MyTest", "method": "testWithDataProvider", "index": 14 },
    { "class": "MyTest", "method": "testWithDataProvider", "index": 19 },
]

After an error, user could uses the command --repeat to make phpunit run initially this failed tests. If no more error is found, then phpunit could continues to run all others tests (except the previously faileds).


Example case:

> phpunit
FAILURES!
Tests: 100, Assertions: 500, Failures: 3.

1. MyTest::testSingle() expects string by get int;
2. MyTest::testWithDataProvider()#14 expects 5 but get 6;
3. MyTest::testWithDataProvider()#19 expects 8 but get 90;

After fix two errors only:

> phpunit --repeat
Rerunning last fails...

FAILURES!
Tests: 100, Assertions: 500, Failures: 1.

1. MyTest::testWithDataProvider()#14 expects 5 but get 18;

After fix last error:

> phpunit --repeat
Rerunning last fails... OK.
Running all others tests...

OK (100 tests, 500 assertions)

Additional commands:

  • User could uses --repeat-fails to repeat only last failed tests (without rerun all);
@sebastianbergmann sebastianbergmann changed the title [6.x] Repeat failed tests Repeat failed tests Jan 24, 2017
@sebastianbergmann sebastianbergmann added the type/enhancement A new idea that should be implemented label Jan 24, 2017
@sebastianbergmann
Copy link
Owner

@lstrojny Are you still interested in moving https://github.com/lstrojny/phpunit-clever-and-smart into PHPUnit's core?

@lstrojny
Copy link
Contributor

lstrojny commented Feb 6, 2017

@sebastianbergmann Do I need to do work for it? 😉 In all seriousness, I am too swamped to do it but I would be totally for phpunit-clever-and-smart to be part of phpunit.

@janvt
Copy link

janvt commented Mar 1, 2017

Would love to get involved in this, have dreamed of similar things (and failed at bash-scripting them) in the past!

@sebastianbergmann
Copy link
Owner

Duplicate of #46.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

4 participants