A logistics company has a test class with a @testSetup method that inserts 50 Shipment__c records. testA deletes 10 of them and testB counts the records. What count does testB see?
- 40, because testA ran first and its deletes persisted
- 50, because each test method gets a fresh copy of the @testSetup data
- 0, because @testSetup data is only visible to the first test method
- It depends on the alphabetical order in which methods run
Show answer
Answer: B
Why: A @testSetup method runs once per class, and its records are reset for each test method. Changes made by one test method are never visible to another.