Improve System.Net.Security code coverage (58%)
It's currently at 58.3% line and 45% branch. Both of these would ideally be at least above 80%.
Status on 6/4/2018:
| System.Net.Security | 6025 | 2721 | 8746 | 32749 | 68.8% | 55.2% |
|---|
Hi, I can try to work on it 🙂
Great, @rjxby I sent you a collaborator invite. Once you do that I can assign you this.
I would also like to work on it.
I already started work on /System project folder, so you can grab a /Common folder, what do you think about this?
Sounds great.
@dnikolovv I just sent you collaborator invite. Please ping me when you accept, I can co-assign it to you. Please coordinate the work with @rjxby to avoid duplicated effort. Thanks for help folks!
@karelz I accepted. @rjxby How should we proceed?
@dnikolovv I think you can start with /Common folder and when I will finish with my part of work you will just rabase on my changes or I can make rebase if you done first, ok? @karelz We can make this issue using two different pull requests from me and from @dnikolovv?
@rjxby whatever works best for you guys. It can be 2 (or more) independent PRs, assuming the code is independent. For additional test coverage it seems very reasonable ...
@karelz ok, cool, thanks 🙂
Someone can explain about the issue? So, maybe i can help as well
The idea is to look at the API surface in the package - look at the tests and code coverage report (linked from main page). Then pick a class starting with System.Net,Security (just search on the code coverage report page), learn how to use it (e.g. MSDN/StackOverflow) and write tests for it. When you pick a class, mention it here, so that others don't pick the same one ...
Here are our New contributor docs - we're actively working on them with @haralabidis, so feel free to help us improve them, or ask questions about them. You can use gitter to ask questions online (someone experienced is usually around), or you can ask here on this issue.
I sent you collaborator invite, ping me when you accept - we can co-assign the work to you as well.
i already accepted. Thanks! i will check the documentation!
It's better now, at 66.9% line coverage. Would still benefit from being much higher.
Unassigning to make it available for anyone interested ...
Hi,
I just submitted a pull request (#26044) for tests on a couple more classes.
If you have any questions or comments, please let me know.
Thanks,
Michael
System.Net.Security has the most potential to improve. Here is the detailed breakdown. There are four areas require attention: System.Net.Security.NegoState, System.Net.Security.NegotiateStream, System.Net.Security.SecureChannel, System.Net.Security.SslState.
They are critical for System.Net.Security, and the uncovered lines for each class is > 200. It makes sense to improve on them first.
Based on the statistics, we should increase those four class’s code coverage to around 90%.
- Those four components have 2841 coverable lines, and 1752 covered lines. Increasing coverage to 90% (2841 * 0.9 – 1752 = 805) will improve overall coverage from 68.6% -> (6001 + 805)/8746 = 77.8%! (this is great)
- Many other components will be covered as well during the above process. So it’s highly possible that, after improving on those four components, the overall coverage will be around a healthy number.
| System.Net.Security | 3814 (Covered) | 1755 (Uncovered) | 5569 (Coverable) | 68.4% (LineCov) |
|---|---|---|---|---|
| System.Net.Security.AuthenticatedStream | 33 | 4 | 37 | 89.1% |
| System.Net.Security.LocalCertificateSelectionCallback | 0 | 0 | 0 | |
| System.Net.Security.LocalCertSelectionCallback | 0 | 0 | 0 | |
| System.Net.Security.NegoState | 257 | 239 | 496 | 51.8% |
| System.Net.Security.NegotiateStream | 366 | 217 | 583 | 62.7% |
| System.Net.Security.NegotiateStreamPal | 154 | 183 | 337 | 45.6% |
| System.Net.Security.ProtocolToken | 21 | 0 | 21 | 100% |
| System.Net.Security.RemoteCertificateValidationCallback | 0 | 0 | 0 | |
| System.Net.Security.RemoteCertValidationCallback | 0 | 0 | 0 | |
| System.Net.Security.SafeCredentialReference | 21 | 2 | 23 | 91.3% |
| System.Net.Security.SafeDeleteContext | 404 | 127 | 531 | 76% |
| System.Net.Security.SafeDeleteContext_SECURITY | 8 | 0 | 8 | 100% |
| System.Net.Security.SafeFreeCertContext | 8 | 0 | 8 | 100% |
| System.Net.Security.SafeFreeContextBuffer | 41 | 12 | 53 | 77.3% |
| System.Net.Security.SafeFreeContextBuffer_SECURITY | 4 | 0 | 4 | 100% |
| System.Net.Security.SafeFreeContextBufferChannelBinding | 30 | 11 | 41 | 73.1% |
| System.Net.Security.SafeFreeContextBufferChannelBinding_SECURITY | 3 | 0 | 3 | 100% |
| System.Net.Security.SafeFreeCredential_SECURITY | 4 | 0 | 4 | 100% |
| System.Net.Security.SafeFreeCredentials | 69 | 6 | 75 | 92% |
| System.Net.Security.SafeSspiAuthDataHandle | 6 | 0 | 6 | 100% |
| System.Net.Security.SecureChannel | 519 | 240 | 759 | 68.3% |
| System.Net.Security.SecurityBuffer | 22 | 15 | 37 | 59.4% |
| System.Net.Security.SecurityContextTokenHandle | 13 | 2 | 15 | 86.6% |
| System.Net.Security.ServerCertificateSelectionCallback | 0 | 0 | 0 | |
| System.Net.Security.ServerCertSelectionCallback | 0 | 0 | 0 | |
| System.Net.Security.SniHelper | 114 | 50 | 164 | 69.5% |
| System.Net.Security.SslApplicationProtocol | 24 | 56 | 80 | 30% |
| System.Net.Security.SslAuthenticationOptions | 31 | 0 | 31 | 100% |
| System.Net.Security.SslClientAuthenticationOptions | 18 | 4 | 22 | 81.8% |
| System.Net.Security.SslConnectionInfo | 10 | 0 | 10 | 100% |
| System.Net.Security.SslServerAuthenticationOptions | 18 | 4 | 22 | 81.8% |
| System.Net.Security.SslSessionsCache | 98 | 25 | 123 | 79.6% |
| System.Net.Security.SslState | 610 | 393 | 1003 | 60.8% |
| System.Net.Security.SslStream | 306 | 84 | 390 | 78.4% |
| System.Net.Security.SslStreamInternal | 286 | 58 | 344 | 83.1% |
| System.Net.Security.SslStreamPal | 303 | 11 | 314 | 96.4% |
| System.Net.Security.SSPIHandleCache | 13 | 12 | 25 | 52% |
This is now > 70%. I'm going to close it. We can still improve further, obviously, but likely driven by touching code that's not covered.