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
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari 

Anyone please explain the difference between @istest and @istest(seealldata=true). I was studied the salesforce article but didn't understand clearly......Thanks in advance

Best Answer chosen by Venkata Sravan Kumar Bandari
Sai Ram ASai Ram A
Hello Venkata Sravan

@isTest
Class is defined using the @isTest annotation can only contain test methods. One advantage of creating a separate class for testing, it don't count against your organization limit of 3 MB for all Apex code.

@istest(seealldata=true)
In test class and methods, we can access data in the organization. Prior to it we can just access test data. Using this we can access organization data. For Apex code saved using Salesforce.com API version 24.0 and later, use the isTest(SeeAllData=true) annotation to grant test classes and individual test methods access to all data in the organization, including pre-existing data that the test didn’t create.
Starting with Apex code saved using Salesforce.com API version 24.0, test methods don’t have access by default to pre-existing data in the organization. However, test code saved against Salesforce.com API version 23.0 or earlier continues to have access to all data in the organization and its data access is unchanged.

P.S.  If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thank you
BLearn - Sai

All Answers

Sai Ram ASai Ram A
Hello Venkata Sravan

@isTest
Class is defined using the @isTest annotation can only contain test methods. One advantage of creating a separate class for testing, it don't count against your organization limit of 3 MB for all Apex code.

@istest(seealldata=true)
In test class and methods, we can access data in the organization. Prior to it we can just access test data. Using this we can access organization data. For Apex code saved using Salesforce.com API version 24.0 and later, use the isTest(SeeAllData=true) annotation to grant test classes and individual test methods access to all data in the organization, including pre-existing data that the test didn’t create.
Starting with Apex code saved using Salesforce.com API version 24.0, test methods don’t have access by default to pre-existing data in the organization. However, test code saved against Salesforce.com API version 23.0 or earlier continues to have access to all data in the organization and its data access is unchanged.

P.S.  If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thank you
BLearn - Sai
This was selected as the best answer
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari
organization data means what..? could you please give me some exapmles
Sai Ram ASai Ram A
Hi Venkat

Please follow this Link, Hope this helps you 
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_data_access.htm

Thank you
BLearn - Sai
Venkata Sravan Kumar BandariVenkata Sravan Kumar Bandari
Yeah i understand the difference thank u for ur reply