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
@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.
@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.
@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
@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
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