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
Felicia Abramson - Bit9Felicia Abramson - Bit9 

How to write Apex Test Class as System Admin

What would be a good resource ot help me write some test classes? I am a certified system administrator with no history of coding. The issue we have is we have alot of code written by a former employee with either no coverage or not 100% coverage, and somehow we got an overall coverage  in production of 72% -- not sure how that happened.

Four classes have four lines each, with no coverage, (if we are able to bump those up to 100% we get to 75% coverage overall), so I think those are going to be my best bets for writing test classes, but like I said, not sure where to start with that.

Any help would be great. Thanks in advance!

Any help would be appreciated. Thanks!
Sai Ram ASai Ram A
Hi

Please follow he Link to start with Test Class https://developer.salesforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

Also you can post your Class here to get some help

Thanks
BLearn
Felicia Abramson - Bit9Felicia Abramson - Bit9
Thanks! Will definitely take a look at the page, and I'll post if I get stuck.

What I am also wondering though, are what are  good methods to figure out what needs to be tested, if you aren't the one who wrote the original code?
Chidambar ReddyChidambar Reddy
Hi Felicia Abramson

Lets say an Apex Trigger in there on the Account,

In your test class, you can just insert Accounts, so it will automatically covers the code

I suggest you to open the developer console 
and Run all tests (Tests > RunALL)
Check over all code coverage after completion of tests (click tests tab below)
User-added image
browse through them and find which class is covered very low
find the test class of it and modify it and run
Check the code coverage using Developer console


Thanks
Close this thread after receiving help, by choosing Best Answer