Activity Forums Salesforce® Discussions How to handle exceptions in test classes in salesforce?

  • Anuj

    Member
    October 20, 2020 at 1:54 pm

    try this code in your test class:

    try {
    insert account ;
    }catch(e) {
    System.assertEquals(e.getMessage(),'revenue should be less than 200');
    }
  • Ayush

    Member
    October 22, 2020 at 3:41 am

    Use try Catch function ;

Log In to reply.

Popular Salesforce Blogs

Salesforce Marketing Cloud Integration with Google Analytics 360

Redefining the future of Marketing – Salesforce Marketing Cloud Integration with Google Analytics 360

Blog in

Know your customers better and make smarter, insight-based marketing decisions through Salesforce’s massive customer relationship management platform twinned with Google Analytics 360’s market-leading digital analytics solution…

Popular Salesforce Videos