Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Salesforce CRM Admin Cookbook

You're reading from   Salesforce CRM Admin Cookbook Solutions to help you implement, configure, and customize your business applications with Salesforce CRM and Lightning Experience

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher
ISBN-13 9781788625517
Length 358 pages
Edition 2nd Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Paul Goodey Paul Goodey
Author Profile Icon Paul Goodey
Paul Goodey
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Making a Picture Paint a Thousand Words... FREE CHAPTER 2. Salesforce CRM's Home Page is Where the Heart is... 3. Automating Work with Salesforce CRM 4. Improving Data Quality in Salesforce CRM 5. Implementing Approval Processes 6. Productivity Tools for Superusers and Advanced Administration 7. Extending Lightning Experience Record Pages 8. Building a Search-First-Before-You-Create Lightning Component

Composing an Apex Test Class


Before we can deploy the Apex Controller class AccountSearchController, which we created in the Developing an Apex Controller to search for accounts recipe, to the production environment, at least 75% of the Apex code must be covered by unit tests, and all of those tests must complete successfully.

Writing unit tests for Apex code is a necessary activity when developing code in the Salesforce platform, and a mandatory requirement before you are able to deploy the code into a Salesforce production environment.

The purpose of the unit tests is to ensure that 75% of the lines of code, as a minimum, have been covered by the unit tests. You should, however, strive to write unit tests that cover every logical path of your code, including any error handling, to achieve 100% code coverage.

How to do it...

Carry out the following steps to create an Apex test class, that provides unit test coverage for our Apex Controller, using the Salesforce Developer Console:

  1. Click on the...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime