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
Andreea TAndreea T 

How to write test class on an Invoice related object

In Account object I have two fields which is taking the values from the Invoice related objects. How to write test class? I am new in development so please help me out to learn to write test classes. 
What are the best practices for test classes on related objects.
Thanks
ApuroopApuroop
Here's something you could start with: 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro

If you need help, you could post your code. If you want to learn and DIY, follow the links above. :)
Tejender Mohan 9Tejender Mohan 9

Hey Imo

You will have to create records in test class for all the objects that your code is accessing.
So in your case, you can create test invoice related object records and test your code.