Activity › Forums › Salesforce® Discussions › What is the purpose of Using "seeAllData=true" in Salesforce Apex?
Tagged: Salesforce Apex, Salesforce Apex Class, Salesforce Apex Code, Salesforce Apex Function, seeAllData
-
What is the purpose of Using "seeAllData=true" in Salesforce Apex?
Posted by Suraj on May 5, 2017 at 10:01 AMWhat is the purpose of Using “seeAllData=true”?
Archit replied 8 years, 1 month ago 4 Members · 3 Replies -
3 Replies
- [adinserter block='9']
-
IsTest(SeeAllData=true) Annotation
use the isTest(SeeAllData=true) annotation to grant test classes and individual test methods access to all data in the organization,
1) If a test class is defined with the isTest(SeeAllData=true) annotation, this annotation applies to all its test methods whether the test methods are defined with the @isTest annotation or the testmethod keyword
2) The isTest(SeeAllData=true) annotation is used to open up data access when applied at the class or method levelUse the isTest(SeeAllData=true) means you need to create the test data in your org.
User, profile, organization, AsyncApexjob, Corntrigger, RecordType, ApexClass, ApexComponent ,ApexPage we can access without (seeAllData=true) .
SeeAllData=true will not work for API 23 version eailer .NOTE:- Always try to avoid use SeeAllData= true because in that case your test class depend on your sandbox data. You May get some issue will deployment.
-
This reply was modified 8 years, 1 month ago by
Neha.
-
This reply was modified 8 years, 1 month ago by
-
Hello Suraj,
By using @isTest(SeeAllData=true) annotation on any class enables all the test methods in this class to access all data in an organisation.
Thanks,
Log In to reply.