+ Start a Discussion

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:


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.


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?