-
Notifications
You must be signed in to change notification settings - Fork 114
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
ZestGuidance does not correctly udpate total Coverage when test fails under every inputs #234
Comments
Thanks for the report! You are right that the total coverage numbers don't take into account failing tests. This is by design. If we update I understand that this makes reporting a bit weird. We usually don't expect targets to have only failing inputs. One thing that we can possibly add is another map that tracks coverage of failing inputs only, and reports that to the status screen in another line. |
Hi @rohanpadhye. I think there could be an elegant solution to this while make the reporting not that weird. The current coverage report can be very misleading when, e.g., all branch of the test in which all path would ultimately result in failures. In my understandings for this case, the total coverage should be at least non-zero if all the failures are triggered. However, the currently implementation of JQF would result in a very small coverage, which is counterintuitive. As for the input selections, I assume that we could deal with the coverages triggered by failure inputs differently. For example, we could mark the coverages as "failure-induced" and have valid inputs "steal" them later if they also cover these coverages. Fixing this could give a more accurate coverage number and also prevent improper comparisons if we want to, e.g., compare between different tools & guidances. |
Thanks for the input @hwang-pku. Marking specific parts of the coverage as "failure-induced" sounds a lot like keeping track of "coverage achieved by failure" and "coverage achieved by normal" separately, which I think is acceptable for reporting purposes. Feel free to open a PR for this, otherwise I will try to work on this in my free time. |
What happened:
When fuzzing a test that will fail under every input, ZestGuidance does not correctly compute the Total Coverage. To be more specific, the total coverage always shows as 0. Another issue caused by this is that
valid coverage
andtotal coverage
are all the same value at any time. Because these two metrics are only updated under valid inputs.How to reproduce:
Try to fuzz the following example test with Zest:
This test always fails because str.length() will not be -1. But the coverage should not be 0.
Example output:
How to improve
In ZestGuidance.java, there should have some totalCoverage update in this else if branch of
handleResult()
method:for example:
Also because there is a coverage responsibility check in
completeCycle()
, so we need to check the saved input responsibility is the same as valid coverage there instead of the total coverage (because Zest does not save invalid input)The text was updated successfully, but these errors were encountered: