How to Create a unit test for a simple Apex class

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

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.