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
Saravana RavikumarSaravana Ravikumar 

Is 'setting the created date of a record using a system method' a valid scenario for execution by unit tests ?

Arun Kumar 1141Arun Kumar 1141

Hi Saravana Ravikumar,

 

Setting the created date of a record using a system method can be a valid scenario for execution by unit tests, depending on the context and requirements of your system.

 

If you have a method or function responsible for setting the created date of a record, you can write unit tests to verify its correctness. This can involve creating a record, calling the method, and then asserting that the created date of the record has been set correctly.

 

For more details, you can also refer to this Salesforce Documentation (https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_test.htm#apex_System_Test_setCreatedDate)

 

If this helps, please mark it as the best answer.

 

Thanks

Arun