0

Below is my test code in short:

@isTest
private class Test_IdaTimeLine_10Day {
    static testMethod void testVGRS()
    {
        testTimeline(Constants.TURNAROUND_1DAY_REVPRIORITY, 'TEST-VGRS');
    }

    private static void testTimeline(String turnaround, String jur) 
    {
        List<Ida_Hearing__c> hearingList = [Select Id, Name From Ida_Hearing__c Limit 100];
        System.debug('hearingList length is: ' + hearingList.size());
        //...

And the result is: hearingList length is 100.

I am very surprised to see why this happens. Because I don't see anywhere in my code specifies seeAllData=true. What is the possible reason of it?

1
  • 4
    what is the api version of apex class?
    – Himanshu
    Oct 25 '17 at 7:30
2

Short Answer: if the API version of your test class is 23.0 or below, its normal. The @IsTest(SeeAllData=true) annotation was released in version 24.0

According to Salesforce documentation https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_isTest.htm#SeeAllDataSectionTitle

For Apex code saved using Salesforce 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 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 API version 23.0 and earlier continues to have access to all data in the organization and its data access is unchanged

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.