-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
@xfail annotation #4481
Comments
I am open to the idea but I do think we should deprecate (and later remove) |
I'm not sure that they're exactly synonymous. @xfail indicates that the feature is incomplete, and markTestIncomplete() indicates that test coverage is missing/deficient and needs to be updated – at least in theory. They're both ways of saying that the test and the code are out of sync, but they do have different meanings and behaviour.
I feel like in most real-world projects incomplete tests are a sloppy way of saying "I don't feel like testing this" and the annotation will remain until the test is discarded completely, but maybe I should have more faith in people.
I'm not opposed to deprecating it, though. It doesn't do anything you couldn't do by ending your test with $this->skip("incomplete").
|
FWIW, besides being often abused, |
This feature can be useful for testing of different PHPUnit constraints and extensions. It would be very convenient just to annotate that a concrete test "should fail". |
Won't implement. |
Any chance yu are open to this in some way other than an @xfail annotation? markTestIncomplete() isnt a great substitute IMO. |
A useful feature of
pytest
is its@pytest.mark.xfail
annotation, which indicates that a test should run but is expected to fail. If a test so annotated does pass, the test run interprets it as a failure.Generally this is used in TDD and BDD to indicate that a bug or feature is still a work in progress. It's distinct from skipping in that the failure when the test starts passing should prompt the developer to remove the annotation or update the test accordingly.
I did some looking around and was surprised to see that this seems to be a unique feature of
pytest
(at least by that name). I'd like to add it to PHPUnit, but wanted to get a 👍 👎 before starting work.The text was updated successfully, but these errors were encountered: