0

I know @isTest annotation is used to mark test classes and by default does not include the data in the org. However, I have noticed that it still includes some of the metadata/configuration of the org (e.g., users, profiles, roles, scheduled jobs, etc.). I am not using SeeAllData=true. Where can I find an exhaustive list of things (or defining criteria) for what is included and what is excluded in test classes marked with @isTest?

  • 1
    In short, everything that is described as "metadata" is included, "data" is not included. – Oleksandr Berehovskyi Sep 21 '17 at 15:48
  • This question shows very little research effort. It is for that reason I have voted down. – Adrian Larson Sep 21 '17 at 18:06
5

Isolation of Test Data from Organization Data in Unit Tests

Starting with Apex code saved using Salesforce API version 24.0 and later, test methods don’t have access by default to pre-existing data in the organization, such as standard objects, custom objects, and custom settings data, and can only access data that they create. However, objects that are used to manage your organization or metadata objects can still be accessed in your tests such as:

  • User
  • Profile
  • Organization
  • AsyncApexJob
  • CronTrigger
  • RecordType
  • ApexClass
  • ApexTrigger
  • ApexComponent
  • ApexPage

Read the document and understand it as there are all sorts of considerations within the doc

Google search is awesome

  • 1
    Beat me to it, here's your +1. – Derek F Sep 21 '17 at 15:53

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.