function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ravi Kumar 259Ravi Kumar 259 

how to cover the try and cactch code in test class

Mudasir WaniMudasir Wani
Dear Ravi,

You just need to create the data that is utilised in the class and your try block code will be covered.
For catch you need to create that condition where your code will through exception.
Paste your sample code here so that we can help.


Donot forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help
ManojjenaManojjena
Hi Ravi ,

Check below link it will help .

https://developer.salesforce.com/forums?id=906F0000000B1x5IAC

Thnaks
Manoj
Ravi Kumar 259Ravi Kumar 259
Thanks you so much Manoy and Wani