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
Add new metric: Test usefulness #1812
Comments
As Infection can infer which test covers which line, IIRC you should be able to figure out which test produces no coverage looking at the coverage report alone. Although this could be a more difficult problem. Unless this problem is harder than it looks, I feel like it could be better to build a dedicated tool. |
@sanmai I think it's slightly different though. You can have some code covered by tests, but mutating that code will not break that test (could break another, so would be fine from infection perspective) which indicates this test is likely flawed. And in order to find out this, you indeed would have no choice but too run infection. |
Then we need a better example. Because in case of |
Indeed @sanmai I'm sorry I missed reporting my real use case scenario. We have a bunch of classes that solve a specific domain goal for which we just need to apply the rules we receive from the client: our gov. I've updated the sample in #1812 (comment): even though |
Thank you @Slamdunk, it all makes much more sense now. There's a slight issue here: if Infection sorts the tests from shortest to longest, then longer tests could be seen as inherently less useful, which may not be the case. We might need to decide if we want to maintain the order of tests if a users requests the test usefulness report. |
Tests order is indeed a factor to count in.
With |
wouldn't these be integration tests rather than unit tests and you could decide not to run them with coverage? while i really like the idea of this one, it might be a slippery slope given false positives? |
Given:
Currently Infection reports everything is OK for any of the
@default
mutators.Fact is though that
FooTest::testTwiceAgain
is utterly useless.What I'd like to have reported is:
https://twitter.com/slamzoe/status/1620719073633107970
The text was updated successfully, but these errors were encountered: