Salesforce Developer Tutorial: How to use DML Mocking in your Apex Tests
In this episode we go over how to setup your codebase to allow you to leverage DML mocking in your apex testing. Leveraging mocking in your tests will allow you to run your tests considerably faster as well as test your code at a much finer level. Schedule Salesforce consulting time with me here: https://calendly.com/codingwiththeforce/60minuteconsult Please consider donating to help continue to improve the content produced for Coding With The Force: https://www.paypal.com/donate?business=RNHEF8ZWKKLDG¤cy_code=USD Get Coding With The Force Merch Here: https://my-store-d20559.creator-spring.com/ GitHub Repo: https://github.com/Coding-With-The-Force/Salesforce-Development-Tutorials/tree/main/DML_Mocking UniversalMock GitHub: https://github.com/surajp/universalmock The MockIdBuilder and MockSObjectBuilder classes were originally created by Caleb Weaver. An extremely talented developer I was very lucky to work with. His code is in my GitHub repo for this video. Follow all of our social media here: Patreon: https://www.patreon.com/CodingWithTheForce Github: https://github.com/Coding-With-The-Force Facebook: https://www.facebook.com/codingwiththeforce/ Twitter: https://twitter.com/Coding_Force Instagram: https://www.instagram.com/codingwiththeforce/ Salesforce development books I recommend: Advanced Apex Programming: https://amzn.to/3lXi8to Salesforce Lightning Platform Enterprise Architecture: https://amzn.to/2R0D4BQ Mastering Salesforce DevOps: https://amzn.to/3lTtTRN Apex Design Patterns Book: https://amzn.to/3DwqljP Good Non-SF Specific Development Books: Clean Code: https://amzn.to/35PuMDU Clean Architecture: https://amzn.to/35FYo6A Design Patterns: Elements of Reusable Object-Oriented Software Book: https://amzn.to/3LhvHBd ------------------------------------------------------------------------------------------------------------------------- Table of Contents: 0:00 - Intro 0:24 - Why use mocking at all 5:44 - What is Mocking 6:54 - How to setup your apex classes to allow mocking 10:36 - How to Setup Mocking in your test classes 23:35 - Understanding how to construct your codebase to use DML Mocking 30:37 - Outro DISCLAIMER: The views and ideas expressed on this YouTube channel and blog are based on past development experiences and may not always work for your particular scenarios. The advice in these videos may also become outdated as technology advances. They should be used as examples for educational purposes only. Using any shown solutions in your own org is not advisable since they are example scenarios. #salesforce #salesforcedeveloper #salesforceadmin
Download
0 formatsNo download links available.