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?

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

1 Answer 1

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
  • 1
    Beat me to it, here's your +1.
    – Derek F
    Sep 21, 2017 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .