Getting Started

  • What is Trailhead
  • myTrailhead
  • Trailblazer Community
  • Career Growth

Learn

  • Trails
  • Trailmixes
  • Modules
  • Projects

Credentials

  • Superbadges
  • Certifications
  • Maintain Certifications

Salesforce

  • Salesforce.com
  • AppExchange
  • Developers
  • Help Portal
© 2026 Salesforce, Inc. All rights reserved. Privacy Terms of Use Trust Accessibility Cookie Preferences
SalesforceTrailhead
  • Today
Apex Testing

Get Started with Apex Unit Tests

+500 Points~45 minsHands-On Challenge
Apex TestingGet Started with Apex Unit Tests

Org:Mindful Goat Playground

Topics

  • Concepts
  • Hands-On Challenge

Looking for help?

Explore Help ResourcesShare Your Feedback
Learning Objectives

After completing this unit, you'll be able to:

  • Describe Apex unit tests.
  • Write and run a test.

Concepts

Unit tests prove your code works and are required to deploy Apex: at least 75% of your code must be covered. Annotate test classes and methods with @isTest.

Hands-On Challenge

  1. Create a class VerifyDate from the unit resources.
  2. Write TestVerifyDate that covers both branches of CheckDates.
  3. Run the tests and confirm 100% coverage.
Check ChallengeDemo check
Next unit Test Apex Triggers