+ Start a Discussion
sudhakar reddy 13sudhakar reddy 13 

What is the use of “seealldata = true”?

Abhishek BansalAbhishek Bansal
This annotation is used in test class to control the availablity of your organisation records in test class.

If seeAllData = true than all of your org data is visible in test class.
If seeAllData = false than your org data is not visible in test class.
Amit Chaudhary 8Amit Chaudhary 8
Please check below post. I hope that will help you
http://amitsalesforce.blogspot.in/2015/09/test-classes-with-istest.html


Use the isTest annotation to define classes and methods that only contain code used for testing your application. The isTest annotation on methods is equivalent to the testMethod keyword.

Classes and methods defined as isTest can be either private or public. Classes defined as isTest must be top-level classes.
One advantage to creating a separate class for testing is that classes defined with isTest don't count against your organization limit of 3 MB for all Apex code.
You can also add the @isTest annotation to individual methods
Classes defined as isTest can't be interfaces or enums
Methods of a test class can only be called from a running test, that is, a test method or code invoked by a test method, and can't be called by a non-test request.
Test methods can’t be used to test Web service callouts. Instead, use mock callouts
You can’t send email messages from a test method
Methods of a public test class can only be called from a running test, that is, a test method or code invoked by a test method, andcan't be called by a non-test request.

***************

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,

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

The isTest(SeeAllData=true) annotation is used to open up data access when applied at the class or method leve

IsTest(OnInstall=true) Annotation
Use the IsTest(OnInstall=true) annotation to specify which Apex tests are executed during package installation. This annotation is used for tests in managed or unmanaged packages

Please let us know if this will help you

Thanks
Amit Chaudhary