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
subra_SFDCsubra_SFDC 

Call private methods in test class

How can we call private methods in apex test class without using isTestVisible?? can any1 give example for this??
AshwaniAshwani
You can not call private method directly form test class without using @isTestVisible annotation. It is possible then we never required this annotation.

But if thet private variable is part of the execution of a piblic method then it will be automatically called. In you calls try to cover functional scenerio if that variable is used in that scenario then you will never need to call that variable directly.

@isTestVisible used in very rare case when there is no other way that the variable going to initialize or assigned.