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
sdusdu 

Why test code cannot see data in sfLMA__License__c??

There are lots of rows in this object, but when I run a query from it in a test method, it is not seeing any rows. Why? How am I suppose to test my code if I cannot see the data??

Best Answer chosen by Admin (Salesforce Developers) 
MandyKoolMandyKool

Hi,

 

In recent release (may be winter or spring 12), test methods has come up with new annotation.

@isTest(SeeAllData=true)

 

when you set "SeeAllData" = true you will be able to get your organizations data in the test code. (Default value is false).

 

Also it is best practice to create your own data instead of querying it from the org. Hope this helps you.

All Answers

MandyKoolMandyKool

Hi,

 

In recent release (may be winter or spring 12), test methods has come up with new annotation.

@isTest(SeeAllData=true)

 

when you set "SeeAllData" = true you will be able to get your organizations data in the test code. (Default value is false).

 

Also it is best practice to create your own data instead of querying it from the org. Hope this helps you.

This was selected as the best answer
sdusdu

Thanks, this solved my problem!