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
ethan huntethan hunt 

Exposed Test Data Vioalation (Seealldata=True)

Hi All,

I need a help on this . In apex test class , if will denote it to seealldata=true code analyzer throws a viaolation of exposed test data.

Is there any harm, or impacts performace for the above.

Regards
Ashish_SFDCAshish_SFDC
Hi, 


See all data true is not a best practice - it is used in situations only when real time data is only option to use for testing the classes. 

That would only expose the Org records to the test class. 

The violation also should mean the same - reply back if the complete error reads something else. 


Regards,
Ashish
sandeep@Salesforcesandeep@Salesforce
Ideally we should not use any data from org so seeAllData = false should be used
kaustav goswamikaustav goswami
Hi Ethan,

If you keep seeAllData = true, then your test class stays dependent on real data. That is the biggest problem.  For test classes to execute successfully you will always be in need of that data set. Otherwise the test classes will fail and might end up hampring your migration processes in future.

Thanks,
Kaustav