Book Image

Learning Apex Programming

5 (1)
Book Image

Learning Apex Programming

5 (1)

Overview of this book

Table of Contents (17 chapters)
Learning Apex Programming
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Always on my mind


There are several things to keep in mind with regard to test coverage; some are related to actually writing the tests themselves, some are more conceptual, while others are still procedural and how the system handles testing.

The rundown

These are the general requirements for testing and test coverage when deploying to production:

  • All classes (including triggers) must compile successfully

  • Every trigger must have at least 1 percent test coverage

  • All tests will be run during deployment, not just those affecting the components you are deploying

  • All tests must run and complete successfully, covering 75 percent of your total code lines for the deployment to succeed

At the parallel

The last bullet of The rundown mentions that all tests are run when deploying. This is true, and they are run sequentially. However, when initiating a test coverage run of all tests, they are run in parallel, which might cause you to run into issues. You should try to write your tests in such a way that you...