Plat-Dev-201 practice question 2 of 30
Which two statements are true about using the @testSetup annotation in an Apex test class? Choose 2 answers
Full set: 204 questions@testSetup methods run once per test class, inserting common test data that every test method can access, saving governor limits. They cannot be used in a class annotated with @isTest(SeeAllData=true); that combination is explicitly unsupported.
A. Records can be updated inside a test method; updates are isolated to that method.
C. testSetup executes only once per class, so its DML counts once, not once per test method.
1. Apex Developer Guide, “Test Setup Methods” (v59.0) – runs once, data shared, cannot be used with SeeAllData=true.
2. Apex Developer Guide, “Isolation of Test Data” (v59.0) – explains visibility and mutability of setup records within individual test methods.
Keep practicing
Take the free Plat-Dev-201 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Plat-Dev-201 practice questions
- Question 1Which three steps allow a custom Scalable Vector Graphic (SVG) to be included in a Lightn…
- Question 3Managers at Universal Containers want to ensure that only decommissioned containers are a…
- Question 4Universal Containers has a Visualforce page that displays a table of every Container__c b…
- Question 5A developer is alerted to an issue with a custom Apex trigger that is causing records to …
- Question 6Which two operations affect the number of times a trigger can fire? Choose 2 answers
- Question 7A team of developers is working on a source-driven project that allows them to work indep…
