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
MANISHA AKHADEMANISHA AKHADE 

hello everyone, i am having test class which having 80% of code coverage can anybody help mi to cover 100% code coverage

AbhinavAbhinav (Salesforce Developers) 
Hi Manisha,

I would suggest go through below link which will help.

Check this:
https://salesforce.stackexchange.com/questions/244788/how-do-i-write-an-apex-unit-test

https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines

If you face any specific issue while attempting do post that here.

Thanks!
Vishnu SanthoshVishnu Santhosh
  • Use the developer console to see which block of code is not running.
  • Make/Change the test data in such a way that it satisfies the conditions to run that block.
  • If its an if-else scenario, try adding two test methods, with one satisfying the if condition and the other satisfying else condition - which result in overall code coverage.

Check this for quick hacks : https://www.apexhours.com/apex-test-class-best-practices/

MANISHA AKHADEMANISHA AKHADE
Thanks a lot. For your valuable guidance.its really helpful.