Salesforce Platform Developer I (legacy) — Question 23

Which two statements are true about using the @testSetup annotation in an Apex test class? (Choose two.)

Answer options

Correct answer: A, B

Explanation

Option A is correct because the @testSetup annotation is not compatible with @isTest(SeeAllData=True), which allows access to all organization data. Option B is also correct as the @testSetup method inserts test data once, making it available for all test methods in the class. Options C and D are incorrect; records created in @testSetup can be updated in test methods, and the @testSetup method runs only once before all methods, not before each one.