Building Unit Test Learning Resources on Salesforce Stack Exchange
- David Reed
Unit testing and code coverage are perennial topics on Salesforce Stack Exchange. It's not hard to see why: unit testing can be profoundly unintuitive for new developers (on any platform), and involves mastering techniques and concepts that are quite different from those needed to be productive in building applications.
Growing out of discussion about community challenges in managing lots of duplicative basic questions, I started a project to write up canonical answers to common questions on unit tests, and bring together the most important resources.
Here's the first-fruits of that project, all of which were posted (by me and other writers) to StackExchange as community wikis. These articles can be expanded and evolved by the Salesforce Stack Exchange community to give learners a basic conceptual framework and connect them to the best resources available on how to test effectively on the Salesforce platform.
Community Wiki Questions on Unit Testing
- How do I write an Apex unit test?, by David Reed
- How do I unit test code that includes a callout?, by David Reed
- How do I increase my code coverage, or why can't I cover these lines?, by David Reed and Pranay Jaiswal
- How do I test asynchronous Apex?, by Pranay Jaiswal and David Reed
- When should I use SeeAllData=true in my test methods?, by cropredy