How to Create a unit test for a simple Apex class

By: Prem Tiwari | Last Updated: | In: Salesforce


In this tutorial, I will explain how to create a unit test for a simple Apex class in Salesforce. Follow the below steps to create a simple Test class for Apex Class.

Step 1) In the Developer Console, click File | New | Apex Class, and enter VerifyDate for the class name, and then click OK.
Step 2) Replace the default class body with the following.

Step 3) Press Ctrl+S to save your apex class.
Step 4) Repeat the previous steps to create the TestVerifyDate class. Add the following for this class.

Reference: Click here

Share this post!


About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.