O'Reilly logo

Mastering Application Development with Force.com by Kevin J. Poorman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Writing Efficient and Useful Unit Tests

Unit testing is the single most important skill an application developer can master. Sadly, writing unit tests is rarely seen as exciting, let alone important. This chapter will focus on testing various Apex components. We will discuss what to test, when to write the tests, and most importantly, how to test. We will cover the following topics:

  • Why do we write unit tests?
  • What to test—discussing positive, negative, and role-based testing
  • When do we write unit tests?
  • How do we structure tests for speed and code reuse?
  • Mocking
  • Tips and tricks for efficient testing

Why do we write unit tests?

Often, it seems that the answer to why do we write unit tests is because Salesforce makes us do it! This, however, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required