1. SeeAllData = True, your test class will see all the data in the system. For Example, If you have 2000 Acc records in your ORG, When you do the query you will see 2000 records.
2. Without SeeAllData = true, You have to initilize all the data for you test classes before you call the test methods.
@isTest(seeAllData=true) annotaion will allow you to access all your organisation data including standrad object ,custom object and custom setting .
However without seeAllData=true you can acess some standrad objects like below.
User Profile RecordType Organization AsyncApexJob CronTrigger ApexClass ApexTrigger ApexComponent ApexPage
All above you can access without seeAllData= true . seeAllData=true you can declare class level or method level as well .If you have declared in method level then the particular method can access your org data .
If you keep seeAllData = true, then your test class stays dependent on real data (ORG data). In that case your test class will work in one org but will fail if same data will not available in other org.
The better/best practice is to not specify this annotation and create your own mock data for unit tests.
Some time you can create some data by Apex code in that you can use SeeAllData= true. Suppose need User login history record in that case you can use SeeAllData= true.
2. Without SeeAllData = true, You have to initilize all the data for you test classes before you call the test methods.
Le
@isTest(seeAllData=true) annotaion will allow you to access all your organisation data including standrad object ,custom object and custom setting .
However without seeAllData=true you can acess some standrad objects like below.
User
Profile
RecordType
Organization
AsyncApexJob
CronTrigger
ApexClass
ApexTrigger
ApexComponent
ApexPage
All above you can access without seeAllData= true .
seeAllData=true you can declare class level or method level as well .If you have declared in method level then the particular method can access your org data .
Let us know in case any doubt you have .
Thanks
Manoj
The better/best practice is to not specify this annotation and create your own mock data for unit tests.
Some time you can create some data by Apex code in that you can use SeeAllData= true. Suppose need User login history record in that case you can use SeeAllData= true.
Thanks
Amit Chaudhary
Le Nguyen
Manoj,
Amit Chadhary,
Thanks for the Explanation.
Akhil.