justicenation / slashclock

/clock concept as a new Slack app
GNU General Public License v3.0
0 stars 0 forks source link

75% code coverage #27

Closed martyychang closed 6 years ago

martyychang commented 6 years ago

All Apex code included in this package should be covered at the 75% level or more.

martyychang commented 6 years ago

As of commit 32035405f6b304a1cfcf288da2d44beb69500476, code coverage as reported by the demo org is 70%.

Your overall code coverage is currently 70%. To deploy code to production, you must have at least 75%.

martyychang commented 6 years ago

Specifically, looks like the following classes need coverage bumped up to at least 75%.

Apex Class Name Line Coverage
AbstractSmartMockSuite 0/7
CommunitiesSelfRegController 30/39
PageService 0/13
Slack 3/5
SlackApi 5/25
SlackApiService 19/53
SlackApiUsersInfoAcmeBunnyMock 0/13
SlackApiUsersInfoBarFooMock 0/13
SlackApiUsersInfoBoardFlipMock 0/13
SlashclockCallbackController 0/20
SlashclockMockSuite 0/7
SmartHttpCalloutMockSuite 17/27
martyychang commented 6 years ago

Just two more classes for which to raise code coverage above 75%

Apex Class Name Percent
SlackService 71%
SlashclockCallbackController 65%

As a side note, the code coverage estimation seems to be way off. The estimate says 74%, but given that only two classes out of many tens have under 75% code coverage while the others have over 80%, I think something's definitely wrong with the estimate.

martyychang commented 6 years ago

I finished covering both SlackService and SlashclockCallbackController 100%, but the estimated code coverage is still showing up as 74%. I tried deleting all test data and then running all tests from the "Apex Classes" page, but the coverage number is still stuck at 74%. 😢

martyychang commented 6 years ago

I figure it's time to get in touch with Salesforce Support. Logged Case 18576006, "Minimum class/trigger coverage is 76% but overall code coverage only 74%?"

martyychang commented 6 years ago

Amazing... even after I accepted the counter-intuitive fact that non-test methods in test classes show up as uncovered in code coverage reports, it looks like even using the @testSetup annotation results in code coverage gaps as the setup method itself appears to not be covered in coverage reports. For this oddity I logged Case 18765911, "Code coverage gap caused by using @testSetup method".

martyychang commented 6 years ago

Seems I'd stumbled upon a limit of which I was previously unaware: "REQUEST_LIMIT_EXCEEDED: AsyncApexTests Limit exceeded"