A developer wants to ensure that test methods in a managed package upgrade test all triggers and classes, and needs to bypass existing organization test data to use only packaged data. Which annotation parameter should be used?
Trap 1: @future(isTest=true)
This is not a valid combination of annotations.
Trap 2: @testVisible
@testVisible allows test methods to access private or protected members of another class.
Trap 3: @isTest(seeAllData=true)
This allows access to organization data, which is an anti-pattern for unit testing.
- A
@testSetup
The @testSetup annotation creates test data once per test class, improving performance and avoiding data isolation issues.
- B
@future(isTest=true)
Why wrong: This is not a valid combination of annotations.
- C
@testVisible
Why wrong: @testVisible allows test methods to access private or protected members of another class.
- D
@isTest(seeAllData=true)
Why wrong: This allows access to organization data, which is an anti-pattern for unit testing.