apex-enterprise-patterns / force-di

Generic DI library with support for Apex, Triggers, Visualforce and Lightning
BSD 3-Clause "New" or "Revised" License
229 stars 100 forks source link

Improve test coverage #89

Closed fransf-wtax closed 1 year ago

fransf-wtax commented 1 year ago

I wasn't able to deploy this project in my org because some classes had less than the required 75% coverage. I added / amended some unit tests to achieve at least 75% coverage on all Apex classes.


This change is Reviewable

ImJohnMDaniel commented 1 year ago

@fransf-wtax, I am assuming that you were trying to deploy this not as a full unit but rather as individual elements. I know that the repo's total code coverage is more than sufficient for production org deployment. If my assumption is incorrect, please me know.

fransf-wtax commented 1 year ago

@ImJohnMDaniel Thanks for your feedback.

I deployed the whole project but specified test level as RunSpecifiedTests because I don't want to run my entire org's tests (which takes hours). However, this sets the minimum test coverage for each class to 75% as described on https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_run_specific_tests.htm . Hence the need to increase test coverage for each class where it was below 75%, even if the total test coverage for all classes combined was over 75%.

There might be more people wanting to deploy the project this way, so while I totally understand your considerations about creating cache partitions, I can imagine the PR has value for some people.

I'll just keep it on my own fork for now so we can use it within our organisation. I'll leave it up to you what to do with it from here on :-)

ImJohnMDaniel commented 1 year ago

@fransf-wtax -- understood. If you would like to maintain your fork for others, that would be appreciated. Having said that, I will close this PR then.