Valid PDI Dumps shared by ExamDiscuss.com for Helping Passing PDI Exam! ExamDiscuss.com now offer the newest PDI exam dumps, the ExamDiscuss.com PDI exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com PDI dumps with Test Engine here:
Which two statements are true about using the @testSetup annotation in an Apex test class? Choose 2 answers
Correct Answer: C,D
Option C: In a test setup method, test data is inserted once and made available for all test methods in the test class. True. The @testSetup method runs once before any test methods in the class. Test data created in this method is available to all test methods, promoting code reuse and efficiency. Reference: Option D: The @testSetup annotation is not supported when the @isTest(SeeAllData=True) annotation is used. True. The @testSetup method is not supported in test classes annotated with @isTest(SeeAllData=true). Using SeeAllData=true accesses existing organization data, conflicting with the isolation provided by @testSetup. Option A: A method defined with the @testSetup annotation executes once for each test method in the test class and counts towards system limits. False. The @testSetup method executes only once per test class, not once per test method. It does count towards the per-test-class limits but improves overall test performance. Option B: Records created in the test setup method cannot be updated in individual test methods. False. Records created in a @testSetup method can be queried and modified within individual test methods. This allows tests to manipulate shared test data as needed. Conclusion: The correct statements are C and D, as they accurately describe the behavior and restrictions of the @testSetup annotation.
Recent Comments (The most recent comments are at the top.)
BA - Mar 11, 2025
B and C should be correct. A is incorrect because the @testSetup method runs only once for the entire test class, not for each individual test method, and does not count towards system limits. D is incorrect because the @testSetup annotation is supported even when @isTest(SeeAllData=true) is used, though it's not recommended to use SeeAllData=true unless necessary.
Recent Comments (The most recent comments are at the top.)
B and C should be correct.
A is incorrect because the @testSetup method runs only once for the entire test class, not for each individual test method, and does not count towards system limits.
D is incorrect because the @testSetup annotation is supported even when @isTest(SeeAllData=true) is used, though it's not recommended to use SeeAllData=true unless necessary.