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
h8r41dh8r41d 

Data visibility, testmethods, isTest(seeAllData=false) questions

So the SF docs say that by default a testmethod has no access to organization data. I'm trying to run a test that directly assumes that the only data in my object is the data that I insert during the test method. However, no matter what I do, I can still select all existing data in the object!

 

There was another question about this posted a while back, but the problem there was that he was working with the users object, which apparently doesn't count. Here, I am working with a custom object.

 

This is a reduction of what I'm working with:

 

@isTest(SeeAllData=FALSE)
private class WOQuarantine_test {

	static testMethod void TestWOQuarantineController() {
		
		geocode_cache__c[] test = [select id from geocode_cache__c];

             system.debug(test.size());  // should be 0!!!
     }
}

 

Can somebody help me understand what I might be doing wrong? I know that seeAllData is supposed to be false by default, but the parameter seems to be having zero effect.

crop1645crop1645

Two thoughts:

 

1. What version is the meta data for this test class?  SeeAllData= only applies to classes v24.0 or higher; 

2. Use the @isTest(SeeAlldata=false) on the testmethod itself, not on the class

Jeff MayJeff May

Is the geo_code_cache a custom object or a custom setting?